diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-20 17:05:24 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-23 21:41:43 (GMT) |
commit | 48adc297211181a97fab75ef0260fda5147c1195 (patch) | |
tree | 17f278522ccaff4b03bc1eb81cb5177fd42d0f37 /Source/CTest | |
parent | bfb69f9543bfa7f9f3c9488bf7e740f21896cec4 (diff) | |
download | CMake-48adc297211181a97fab75ef0260fda5147c1195.zip CMake-48adc297211181a97fab75ef0260fda5147c1195.tar.gz CMake-48adc297211181a97fab75ef0260fda5147c1195.tar.bz2 |
replace "std::string::find(x) == 0" with cmHasPrefix()
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 32 | ||||
-rw-r--r-- | Source/CTest/cmParseCoberturaCoverage.cxx | 2 |
2 files changed, 20 insertions, 14 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 5e29386..db426b2 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -379,7 +379,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( const std::vector<std::string>& allArgs) { // --build-and-test options - if (currentArg.find("--build-and-test", 0) == 0 && + if (cmHasLiteralPrefix(currentArg, "--build-and-test") && idx < allArgs.size() - 1) { if (idx + 2 < allArgs.size()) { idx++; @@ -397,25 +397,29 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( return 0; } } - if (currentArg.find("--build-target", 0) == 0 && idx < allArgs.size() - 1) { + if (cmHasLiteralPrefix(currentArg, "--build-target") && + idx < allArgs.size() - 1) { idx++; this->BuildTargets.push_back(allArgs[idx]); } - if (currentArg.find("--build-nocmake", 0) == 0) { + if (cmHasLiteralPrefix(currentArg, "--build-nocmake")) { this->BuildNoCMake = true; } - if (currentArg.find("--build-run-dir", 0) == 0 && idx < allArgs.size() - 1) { + if (cmHasLiteralPrefix(currentArg, "--build-run-dir") && + idx < allArgs.size() - 1) { idx++; this->BuildRunDir = allArgs[idx]; } - if (currentArg.find("--build-two-config", 0) == 0) { + if (cmHasLiteralPrefix(currentArg, "--build-two-config")) { this->BuildTwoConfig = true; } - if (currentArg.find("--build-exe-dir", 0) == 0 && idx < allArgs.size() - 1) { + if (cmHasLiteralPrefix(currentArg, "--build-exe-dir") && + idx < allArgs.size() - 1) { idx++; this->ExecutableDirectory = allArgs[idx]; } - if (currentArg.find("--test-timeout", 0) == 0 && idx < allArgs.size() - 1) { + if (cmHasLiteralPrefix(currentArg, "--test-timeout") && + idx < allArgs.size() - 1) { idx++; this->Timeout = cmDuration(atof(allArgs[idx].c_str())); } @@ -431,31 +435,33 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( idx++; this->BuildGeneratorToolset = allArgs[idx]; } - if (currentArg.find("--build-project", 0) == 0 && idx < allArgs.size() - 1) { + if (cmHasLiteralPrefix(currentArg, "--build-project") && + idx < allArgs.size() - 1) { idx++; this->BuildProject = allArgs[idx]; } - if (currentArg.find("--build-makeprogram", 0) == 0 && + if (cmHasLiteralPrefix(currentArg, "--build-makeprogram") && idx < allArgs.size() - 1) { idx++; this->BuildMakeProgram = allArgs[idx]; } - if (currentArg.find("--build-config-sample", 0) == 0 && + if (cmHasLiteralPrefix(currentArg, "--build-config-sample") && idx < allArgs.size() - 1) { idx++; this->ConfigSample = allArgs[idx]; } - if (currentArg.find("--build-noclean", 0) == 0) { + if (cmHasLiteralPrefix(currentArg, "--build-noclean")) { this->BuildNoClean = true; } - if (currentArg.find("--build-options", 0) == 0) { + if (cmHasLiteralPrefix(currentArg, "--build-options")) { while (idx + 1 < allArgs.size() && allArgs[idx + 1] != "--build-target" && allArgs[idx + 1] != "--test-command") { ++idx; this->BuildOptions.push_back(allArgs[idx]); } } - if (currentArg.find("--test-command", 0) == 0 && idx < allArgs.size() - 1) { + if (cmHasLiteralPrefix(currentArg, "--test-command") && + idx < allArgs.size() - 1) { ++idx; this->TestCommand = allArgs[idx]; while (idx + 1 < allArgs.size()) { diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 05da84e..711a856 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -67,7 +67,7 @@ protected: // Check if this is an absolute path that falls within our // source or binary directories. for (std::string const& filePath : FilePaths) { - if (filename.find(filePath) == 0) { + if (cmHasPrefix(filename, filePath)) { this->CurFileName = filename; break; } |