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/CPack | |
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/CPack')
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 363f536..f7edc91 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -103,7 +103,7 @@ int cmCPackNSISGenerator::PackageFiles() componentName = fileN.substr(0, slash); // Strip off the component part of the path. - fileN = fileN.substr(slash + 1); + fileN.erase(0, slash + 1); } } std::replace(fileN.begin(), fileN.end(), '/', '\\'); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index dc31623..2e5bde2 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -85,7 +85,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, return 0; } std::string key = value.substr(0, pos); - value = value.substr(pos + 1); + value.erase(0, pos + 1); def->Map[key] = value; cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " << key << " to \"" << value << "\"" |