From 0f7ec9309921884cff6e794ca0b5b583bcaa5092 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer <daniel@pfeifer-mail.de> Date: Mon, 29 May 2017 09:30:45 +0200 Subject: [PATCH] Pass std::string as const& --- SystemInformation.cxx | 3 ++- testSystemTools.cxx | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/SystemInformation.cxx b/SystemInformation.cxx index bfc895e..b7bd102 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -918,7 +918,8 @@ int LoadLines(const char* fileName, std::vector<std::string>& lines) // **************************************************************************** template <typename T> -int NameValue(std::vector<std::string>& lines, std::string name, T& value) +int NameValue(std::vector<std::string> const& lines, std::string const& name, + T& value) { size_t nLines = lines.size(); for (size_t i = 0; i < nLines; ++i) { diff --git a/testSystemTools.cxx b/testSystemTools.cxx index 900894c..e6fbf6c 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -54,7 +54,8 @@ static const char* toUnixPaths[][2] = { { 0, 0 } }; -static bool CheckConvertToUnixSlashes(std::string input, std::string output) +static bool CheckConvertToUnixSlashes(std::string const& input, + std::string const& output) { std::string result = input; kwsys::SystemTools::ConvertToUnixSlashes(result); @@ -71,8 +72,9 @@ static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\", { " {} ", "{}", "#", " #{#} " }, { 0, 0, 0, 0 } }; -static bool CheckEscapeChars(std::string input, const char* chars_to_escape, - char escape_char, std::string output) +static bool CheckEscapeChars(std::string const& input, + const char* chars_to_escape, char escape_char, + std::string const& output) { std::string result = kwsys::SystemTools::EscapeChars( input.c_str(), chars_to_escape, escape_char); -- GitLab