Prefer find(char) over find(const char *)

The former can be faster.  Found via clang-tidy.
This commit is contained in:
Andrew Gaul
2019-01-17 20:24:24 -08:00
parent 25b49e1a2e
commit e29548178b
3 changed files with 11 additions and 11 deletions

View File

@ -210,15 +210,15 @@ bool takeout_str_dquart(string& str)
size_t pos;
// '"' for start
if(string::npos != (pos = str.find_first_of("\""))){
if(string::npos != (pos = str.find_first_of('\"'))){
str = str.substr(pos + 1);
// '"' for end
if(string::npos == (pos = str.find_last_of("\""))){
if(string::npos == (pos = str.find_last_of('\"'))){
return false;
}
str = str.substr(0, pos);
if(string::npos != str.find_first_of("\"")){
if(string::npos != str.find_first_of('\"')){
return false;
}
}