From 0488ceefa3365d0083ce1751f1648318c09c11d6 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 16 Sep 2019 19:35:31 +0100 Subject: [PATCH] util_string cleanup: Remove const-ref arg rtrim The by-value version is always better as we need to copy the argument anyway, and now it can be a move instead. --- src/util_string.cpp | 13 ------------- src/util_string.hpp | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/util_string.cpp b/src/util_string.cpp index 65f48da9e..cc15d36b6 100644 --- a/src/util_string.cpp +++ b/src/util_string.cpp @@ -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()); diff --git a/src/util_string.hpp b/src/util_string.hpp index dd0abc3cc..8aad9328a 100644 --- a/src/util_string.hpp +++ b/src/util_string.hpp @@ -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);