diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-21 11:51:46 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2020-03-23 21:41:44 (GMT) |
commit | ef778d77e0795ecba8af55a6984ad5fa5f44377a (patch) | |
tree | f2256f9fac53cc2be8840bc69cf1f8feb32c17f6 /Source/cmCTest.cxx | |
parent | 77616f46817b6527c7e515de547625e554df21f9 (diff) | |
download | CMake-ef778d77e0795ecba8af55a6984ad5fa5f44377a.zip CMake-ef778d77e0795ecba8af55a6984ad5fa5f44377a.tar.gz CMake-ef778d77e0795ecba8af55a6984ad5fa5f44377a.tar.bz2 |
replace std::string::substr() with operations that do not allocate memory
Modify the original string instead of creating a new copy with substr() when it
is not used for anything else afterwards.
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 5359492..72ec1b5 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -725,7 +725,7 @@ bool cmCTest::UpdateCTestConfiguration() continue; } while (fin && (line.back() == '\\')) { - line = line.substr(0, line.size() - 1); + line.resize(line.size() - 1); buffer[0] = 0; fin.getline(buffer, 1023); buffer[1023] = 0; @@ -2668,7 +2668,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname) path = "./" + *res; if (path.back() == '/') { - path = path.substr(0, path.size() - 1); + path.resize(path.size() - 1); } } |