Remove unnecessary string copies

Found via clang-tidy.
This commit is contained in:
Andrew Gaul 2019-01-22 23:04:47 -08:00
parent fada95f58e
commit 61ecafd426
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);
}
/**