diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 19:24:10 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 21:22:24 (GMT) |
commit | 5784747d1b0404a0c1cb0223b15b823476023fba (patch) | |
tree | 763d07bbde561ad1a2322328764b93b6c1852db2 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | 5cec953e6aafd4c132a7b6c0a929d95c1dee79ea (diff) | |
download | CMake-5784747d1b0404a0c1cb0223b15b823476023fba.zip CMake-5784747d1b0404a0c1cb0223b15b823476023fba.tar.gz CMake-5784747d1b0404a0c1cb0223b15b823476023fba.tar.bz2 |
Improve string find: prefer character overloads.
Apply fix-its from clang-tidy's performance-faster-string-find checker.
Ignore findings in kwsys.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index defac95..46891b7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -71,7 +71,7 @@ private: static std::string cmSplitExtension(std::string const& in, std::string& base) { std::string ext; - std::string::size_type dot_pos = in.rfind("."); + std::string::size_type dot_pos = in.rfind('.'); if (dot_pos != std::string::npos) { // Remove the extension first in case &base == &in. ext = in.substr(dot_pos, std::string::npos); @@ -949,11 +949,11 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( cmSystemTools::ReplaceString(cmd, "/./", "/"); // Convert the command to a relative path only if the current // working directory will be the start-output directory. - bool had_slash = cmd.find("/") != cmd.npos; + bool had_slash = cmd.find('/') != cmd.npos; if (workingDir.empty()) { cmd = this->Convert(cmd, START_OUTPUT); } - bool has_slash = cmd.find("/") != cmd.npos; + bool has_slash = cmd.find('/') != cmd.npos; if (had_slash && !has_slash) { // This command was specified as a path to a file in the // current directory. Add a leading "./" so it can run @@ -975,9 +975,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( // must be written {{} instead of just {. Otherwise some // curly braces are removed. The hack can be skipped if the // first curly brace is the last character. - std::string::size_type lcurly = cmd.find("{"); + std::string::size_type lcurly = cmd.find('{'); if (lcurly != cmd.npos && lcurly < (cmd.size() - 1)) { - std::string::size_type rcurly = cmd.find("}"); + std::string::size_type rcurly = cmd.find('}'); if (rcurly == cmd.npos || rcurly > lcurly) { // The first curly is a left curly. Use the hack. std::string hack_cmd = cmd.substr(0, lcurly); |