summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx1
-rw-r--r--Source/CTest/cmCTestGIT.cxx1
-rw-r--r--Source/CTest/cmCTestP4.cxx1
-rw-r--r--Source/CTest/cmCTestVC.cxx1
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmCommonTargetGenerator.cxx1
-rw-r--r--Source/cmServerProtocol.cxx3
-rw-r--r--Source/cmStateDirectory.cxx1
-rw-r--r--Source/cmSystemTools.cxx1
-rw-r--r--Source/cmcmd.cxx1
-rw-r--r--Source/ctest.cxx1
11 files changed, 13 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 1da42d4..f4fc769 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 7fe74af..8cb795e 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 11f6a00..fdf8932 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 7e09ef0..fd7f37a 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 e248219..4ea1493 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 bd4077f..1189606 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 1b47608..e835b7a 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 5aa8e5b..85e6366 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 6fdfd44..26073d3 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 5a9e321..c0c7d03 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 fe24a72..f6466fa 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]);
}