Merge pull request #920 from gaul/clang-tidy/string-copy

Remove unnecessary string copies
This commit is contained in:
Takeshi Nakatani 2019-01-23 19:30:55 +09:00 committed by GitHub
commit f219817eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -4261,7 +4261,7 @@ string get_canonical_headers(const struct curl_slist* list)
// skip empty-value headers (as they are discarded by libcurl)
continue;
}
strhead = strkey + string(":") + strval;
strhead = strkey.append(":").append(strval);
}else{
strhead = trim(lower(strhead));
}
@ -4290,7 +4290,7 @@ string get_canonical_headers(const struct curl_slist* list, bool only_amz)
// skip empty-value headers (as they are discarded by libcurl)
continue;
}
strhead = strkey + string(":") + strval;
strhead = strkey.append(":").append(strval);
}else{
strhead = trim(lower(strhead));
}

View File

@ -120,8 +120,7 @@ string trim_right(const string &s, const string &t /* = SPACES */)
string trim(const string &s, const string &t /* = SPACES */)
{
string d(s);
return trim_left(trim_right(d, t), t);
return trim_left(trim_right(s, t), t);
}
/**