diff options
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestP4.cxx | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestVC.cxx | 1 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 2 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 3 | ||||
-rw-r--r-- | Source/cmStateDirectory.cxx | 1 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 1 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 1 | ||||
-rw-r--r-- | Source/ctest.cxx | 1 |
11 files changed, 13 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 1da42d461f..f4fc769299 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -769,6 +769,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, } std::vector<const char*> argv; + argv.reserve(args.size() + 1); for (std::string const& arg : args) { argv.push_back(arg.c_str()); } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 7fe74af01b..8cb795e221 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -214,6 +214,7 @@ bool cmCTestGIT::UpdateByCustom(std::string const& custom) std::vector<std::string> git_custom_command; cmSystemTools::ExpandListArgument(custom, git_custom_command, true); std::vector<char const*> git_custom; + git_custom.reserve(git_custom_command.size() + 1); for (std::string const& i : git_custom_command) { git_custom.push_back(i.c_str()); } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 11f6a006aa..fdf8932437 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -464,6 +464,7 @@ bool cmCTestP4::UpdateCustom(const std::string& custom) cmSystemTools::ExpandListArgument(custom, p4_custom_command, true); std::vector<char const*> p4_custom; + p4_custom.reserve(p4_custom_command.size() + 1); for (std::string const& i : p4_custom_command) { p4_custom.push_back(i.c_str()); } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 7e09ef0f3f..fd7f37ac8c 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -56,6 +56,7 @@ bool cmCTestVC::InitialCheckout(const char* command) // Construct the initial checkout command line. std::vector<std::string> args = cmSystemTools::ParseArguments(command); std::vector<char const*> vc_co; + vc_co.reserve(args.size() + 1); for (std::string const& arg : args) { vc_co.push_back(arg.c_str()); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e2482197fd..4ea14931e8 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -969,6 +969,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, } std::vector<const char*> argv; + argv.reserve(args.size() + 1); for (std::string const& a : args) { argv.push_back(a.c_str()); } @@ -2569,6 +2570,7 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args, const char* dir, double timeout, Encoding encoding) { std::vector<const char*> argv; + argv.reserve(args.size() + 1); for (std::string const& a : args) { argv.push_back(a.c_str()); } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index bd4077f7b6..1189606fcb 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -194,6 +194,7 @@ std::string cmCommonTargetGenerator::GetManifests() this->GeneratorTarget->GetManifests(manifest_srcs, this->ConfigName); std::vector<std::string> manifests; + manifests.reserve(manifest_srcs.size()); for (cmSourceFile const* manifest_src : manifest_srcs) { manifests.push_back(this->LocalCommonGenerator->ConvertToOutputFormat( this->LocalCommonGenerator->ConvertToRelativePath( diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 1b476089d5..e835b7a2c3 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -602,11 +602,12 @@ bool LanguageData::operator==(const LanguageData& other) const void LanguageData::SetDefines(const std::set<std::string>& defines) { std::vector<std::string> result; + result.reserve(defines.size()); for (std::string const& i : defines) { result.push_back(i); } std::sort(result.begin(), result.end()); - Defines = result; + Defines = std::move(result); } namespace std { diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 5aa8e5bbaa..85e6366d96 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -442,6 +442,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, std::vector<std::string> child_dirs; std::vector<cmStateSnapshot> const& children = this->DirectoryState->Children; + child_dirs.reserve(children.size()); for (cmStateSnapshot const& ci : children) { child_dirs.push_back(ci.GetDirectory().GetCurrentSource()); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 6fdfd44608..26073d31c2 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -700,6 +700,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command, double timeout, Encoding encoding) { std::vector<const char*> argv; + argv.reserve(command.size() + 1); for (std::string const& cmd : command) { argv.push_back(cmd.c_str()); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5a9e321488..c0c7d03a37 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -348,6 +348,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) std::bind(&cmcmd::HandleCppCheck, a1, a2, a3); // copy the command options to a vector of strings std::vector<std::string> commandOptions; + commandOptions.reserve(coCompileTypes.size()); for (const auto& i : coCompileTypes) { commandOptions.push_back(i.first); } diff --git a/Source/ctest.cxx b/Source/ctest.cxx index fe24a720d4..f6466fad73 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -186,6 +186,7 @@ int main(int argc, char const* const* argv) // copy the args to a vector std::vector<std::string> args; + args.reserve(argc); for (int i = 0; i < argc; ++i) { args.push_back(argv[i]); } |