Remove one unnecessary backslash-check in StringReader::getTokens(). (This patch looks like it's removing the last backslash-counting loop, but really it removes the first one and then reindents everything.)

This commit is contained in:
Jason Orendorff
2013-10-25 02:32:39 -07:00
parent 64a405cab1
commit 727529fe0b

View File

@@ -43,20 +43,11 @@ std::string StringReader::getTokens(const char *stop_chars, bool truncateEnd)
size_t found_pos = rd_string.find_first_of(stop_chars, str_pos);
if (rd_string[str_pos] == '\"') {
//See if we have an even or odd number of backslashes (that is, this quote is not or is escaped)
int numBackslashes = 0;
int countBack = 1;
while (str_pos-countBack >= 0 && rd_string[str_pos-countBack] == '\\') {
numBackslashes++;
countBack++;
}
//If the quote is not escaped
if (numBackslashes % 2 == 0) {
//Find the next quote
found_pos = rd_string.find("\"", str_pos+1);
//Check to see if the quote is escaped
numBackslashes = 0;
countBack = 1;
int numBackslashes = 0;
int countBack = 1;
while (found_pos >= countBack && rd_string[found_pos-countBack] == '\\') {
numBackslashes++;
countBack++;
@@ -74,7 +65,6 @@ std::string StringReader::getTokens(const char *stop_chars, bool truncateEnd)
}
}
}
}
if (found_pos == str_pos) //We are at the endline
{