Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
util_string cleanup: Remove const-ref arg rtrim
Browse files Browse the repository at this point in the history
The by-value version is always better as we need to copy the argument
anyway, and now it can be a move instead.
  • Loading branch information
glebm committed Sep 16, 2019
1 parent 8e22cd4 commit 0488cee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
13 changes: 0 additions & 13 deletions src/util_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ namespace Sass {
}
// EO unvendor

std::string rtrim(const std::string& str) {

std::string trimmed = str;
size_t pos_ws = trimmed.find_last_not_of(" \t\n\v\f\r");
if (pos_ws != std::string::npos) {
trimmed.erase(pos_ws + 1);
}
else {
trimmed.clear();
}
return trimmed;
}

std::string normalize_newlines(const std::string& str) {
std::string result;
result.reserve(str.size());
Expand Down
2 changes: 1 addition & 1 deletion src/util_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Sass {
// ###########################################################################
std::string unvendor(const std::string& name);

std::string rtrim(const std::string& str);
std::string rtrim(std::string str);
std::string normalize_newlines(const std::string& str);
std::string normalize_underscores(const std::string& str);
std::string normalize_decimals(const std::string& str);
Expand Down

0 comments on commit 0488cee

Please sign in to comment.