Skip to content

Commit

Permalink
toupper/tolower is already receiving a copy, so it doesn't need to cr…
Browse files Browse the repository at this point in the history
…eate a new one to transform it
  • Loading branch information
eduar-hte committed May 4, 2024
1 parent 92966a6 commit f361341
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/utils/string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,28 +154,22 @@ std::string toHexIfNeeded(const std::string &str, bool escape_spec) {


std::string tolower(std::string str) {
std::string value;
value.resize(str.length());

std::transform(str.begin(),
str.end(),
value.begin(),
str.begin(),
::tolower);

return value;
return str;
}


std::string toupper(std::string str) {
std::string value;
value.resize(str.length());

std::transform(str.begin(),
str.end(),
value.begin(),
str.begin(),
::toupper);

return value;
return str;
}


Expand Down

0 comments on commit f361341

Please sign in to comment.