diff options
author | Brad King <brad.king@kitware.com> | 2017-05-28 13:13:06 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-05-28 13:13:12 (GMT) |
commit | f8642f953d3d8547bd31fcb35a4737fa91d9126f (patch) | |
tree | 1a56170d6d43c1515b49142c7223ea06eb7faa5d /Source/cmSystemTools.cxx | |
parent | f9ea6247c10fa0b39977f9b75d266e7282b19a1b (diff) | |
parent | 2c2bb5f527b4c0e0eca7867492c046be23818c9a (diff) | |
download | CMake-f8642f953d3d8547bd31fcb35a4737fa91d9126f.zip CMake-f8642f953d3d8547bd31fcb35a4737fa91d9126f.tar.gz CMake-f8642f953d3d8547bd31fcb35a4737fa91d9126f.tar.bz2 |
Merge topic 'reduce-string-copying'
2c2bb5f5 Remove unnecessary operator<< usage
1e4e2f99 Remove unused variables
25486156 Improved checking for number of arguments passed
86dc86dd Add const-reference qualifications
76bdb407 Change std::basic_string<char> to std::string
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !886
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 8978e18..dc7034e 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -196,7 +196,6 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, while (regEntry.find(source)) { // the arguments are the second match std::string key = regEntry.match(1); - std::string val; std::string reg = "["; reg += key + "]"; cmSystemTools::ReplaceString(source, reg.c_str(), "/registry"); @@ -348,12 +347,12 @@ bool cmSystemTools::IsInternallyOn(const char* val) if (!val) { return false; } - std::basic_string<char> v = val; + std::string v = val; if (v.size() > 4) { return false; } - for (std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) { + for (std::string::iterator c = v.begin(); c != v.end(); c++) { *c = static_cast<char>(toupper(*c)); } return v == "I_ON"; @@ -368,7 +367,7 @@ bool cmSystemTools::IsOn(const char* val) if (len > 4) { return false; } - std::basic_string<char> v(val, len); + std::string v(val, len); static std::set<std::string> onValues; if (onValues.empty()) { @@ -378,7 +377,7 @@ bool cmSystemTools::IsOn(const char* val) onValues.insert("TRUE"); onValues.insert("Y"); } - for (std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) { + for (std::string::iterator c = v.begin(); c != v.end(); c++) { *c = static_cast<char>(toupper(*c)); } return (onValues.count(v) > 0); @@ -413,8 +412,8 @@ bool cmSystemTools::IsOff(const char* val) offValues.insert("IGNORE"); } // Try and avoid toupper(). - std::basic_string<char> v(val, len); - for (std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) { + std::string v(val, len); + for (std::string::iterator c = v.begin(); c != v.end(); c++) { *c = static_cast<char>(toupper(*c)); } return (offValues.count(v) > 0); |