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/CTest | |
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/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmParseDelphiCoverage.cxx | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 20b0e9c..7141daf 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -617,7 +617,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) cmSystemTools::ConvertToUnixSlashes(cm->SourceFile); if (cm->SourceFile.find("/.../") != cm->SourceFile.npos) { cmSystemTools::ReplaceString(cm->SourceFile, "/.../", ""); - std::string::size_type p = cm->SourceFile.find("/"); + std::string::size_type p = cm->SourceFile.find('/'); if (p != cm->SourceFile.npos) { cm->SourceFile = cm->SourceFile.substr(p + 1, cm->SourceFile.size() - p); diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 550a774..51456ed 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1238,7 +1238,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // Initially all entries are -1 (not used). If we get coverage // information, increment it to 0 first. if (vec[lineIdx] < 0) { - if (cov > 0 || prefix.find("#") != prefix.npos) { + if (cov > 0 || prefix.find('#') != prefix.npos) { vec[lineIdx] = 0; } } @@ -1543,7 +1543,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( // Initially all entries are -1 (not used). If we get coverage // information, increment it to 0 first. if (vec[lineIdx] < 0) { - if (cov > 0 || prefix.find("#") != prefix.npos) { + if (cov > 0 || prefix.find('#') != prefix.npos) { vec[lineIdx] = 0; } } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index bbc6b37..f373348 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -417,7 +417,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } } std::string upload_as = url + - ((url.find("?", 0) == std::string::npos) ? "?" : "&") + "FileName=" + + ((url.find('?') == std::string::npos) ? '?' : '&') + "FileName=" + ofile; upload_as += "&MD5="; @@ -706,7 +706,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files, } } std::string turl = url + - ((url.find("?", 0) == std::string::npos) ? "?" : "&") + "xmlfile=" + + ((url.find('?') == std::string::npos) ? '?' : '&') + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl << std::endl; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 4935f11..20ef693 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1869,7 +1869,7 @@ bool cmCTestTestHandler::SetTestsProperties( cmSystemTools::ExpandListArgument(val, rtit->Labels); } if (key == "MEASUREMENT") { - size_t pos = val.find_first_of("="); + size_t pos = val.find_first_of('='); if (pos != val.npos) { std::string mKey = val.substr(0, pos); const char* mVal = val.c_str() + pos + 1; diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index d20b16a..2e06078 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -171,7 +171,7 @@ public: } lastoffset = line.find("class="); - endcovpos = line.find(">", lastoffset); + endcovpos = line.find('>', lastoffset); lineresult = line.substr(lastoffset + 7, (endcovpos - 8) - lastoffset); if (lineresult == "covered") { |