diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-20 16:04:40 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-23 19:19:26 (GMT) |
commit | bfb69f9543bfa7f9f3c9488bf7e740f21896cec4 (patch) | |
tree | 866c20d05a20fae42cf06ef848796ba621d643f2 /Source/CTest | |
parent | 7df84ffe58572a4535b08bc7b76148a60d38fbb4 (diff) | |
download | CMake-bfb69f9543bfa7f9f3c9488bf7e740f21896cec4.zip CMake-bfb69f9543bfa7f9f3c9488bf7e740f21896cec4.tar.gz CMake-bfb69f9543bfa7f9f3c9488bf7e740f21896cec4.tar.bz2 |
replace "substr(0, xx) ==" with cmHasPrefix()
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 7 | ||||
-rw-r--r-- | Source/CTest/cmParseCacheCoverage.cxx | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 4a0ad33..daa10c9 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -680,8 +680,9 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf) // #ifdef _WIN32 # define fnc(s) cmSystemTools::LowerCase(s) +# define fnc_prefix(s, t) fnc(s.substr(0, t.size())) == fnc(t) #else -# define fnc(s) s +# define fnc_prefix(s, t) cmHasPrefix(s, t) #endif bool IsFileInDir(const std::string& infile, const std::string& indir) @@ -689,8 +690,8 @@ bool IsFileInDir(const std::string& infile, const std::string& indir) std::string file = cmSystemTools::CollapseFullPath(infile); std::string dir = cmSystemTools::CollapseFullPath(indir); - return file.size() > dir.size() && - fnc(file.substr(0, dir.size())) == fnc(dir) && file[dir.size()] == '/'; + return file.size() > dir.size() && fnc_prefix(file, dir) && + file[dir.size()] == '/'; } int cmCTestCoverageHandler::HandlePHPCoverage( diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index b8329ea..1a5e7c5 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -155,7 +155,7 @@ bool cmParseCacheCoverage::ReadCMCovFile(const char* file) // if we have a routine name, check for end of routine else { // Totals in arg 0 marks the end of a routine - if (separateLine[0].substr(0, 6) == "Totals") { + if (cmHasLiteralPrefix(separateLine[0], "Totals")) { routine.clear(); // at the end of this routine filepath.clear(); continue; // move to next line |