diff options
author | Rose <83477269+AtariDreams@users.noreply.github.com> | 2023-10-16 23:43:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-10-23 15:18:32 (GMT) |
commit | 9ca6dfc280b086fcf139f631f294281e234f5752 (patch) | |
tree | a5c60e2d93b8c4ad6a56eb28a0aeabb8bca404cf /Source/CTest/cmCTestSVN.cxx | |
parent | aaeb2e0aa868af3cfe927e1ff8c79faa8bdcf28f (diff) | |
download | CMake-9ca6dfc280b086fcf139f631f294281e234f5752.zip CMake-9ca6dfc280b086fcf139f631f294281e234f5752.tar.gz CMake-9ca6dfc280b086fcf139f631f294281e234f5752.tar.bz2 |
Source: Reduce vector entry allocations and copies
Prefer `emplace_back` over `push_back`.
Diffstat (limited to 'Source/CTest/cmCTestSVN.cxx')
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 14bc510..fc7051c 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -34,7 +34,7 @@ cmCTestSVN::~cmCTestSVN() = default; void cmCTestSVN::CleanupImpl() { std::vector<std::string> svn_cleanup; - svn_cleanup.push_back("cleanup"); + svn_cleanup.emplace_back("cleanup"); OutputLogger out(this->Log, "cleanup-out> "); OutputLogger err(this->Log, "cleanup-err> "); this->RunSVNCommand(svn_cleanup, &out, &err); @@ -89,7 +89,7 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) { // Run "svn info" to get the repository info from the work tree. std::vector<std::string> svn_info; - svn_info.push_back("info"); + svn_info.emplace_back("info"); svn_info.push_back(svninfo.LocalPath); std::string rev; InfoParser out(this, "info-out> ", rev, svninfo); @@ -252,7 +252,7 @@ bool cmCTestSVN::UpdateImpl() } std::vector<std::string> svn_update; - svn_update.push_back("update"); + svn_update.emplace_back("update"); cm::append(svn_update, args); UpdateParser out(this, "up-out> "); @@ -270,7 +270,7 @@ bool cmCTestSVN::RunSVNCommand(std::vector<std::string> const& parameters, std::vector<std::string> args; args.push_back(this->CommandLineTool); cm::append(args, parameters); - args.push_back("--non-interactive"); + args.emplace_back("--non-interactive"); std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions"); @@ -388,11 +388,11 @@ bool cmCTestSVN::LoadRevisions(SVNInfo& svninfo) // Run "svn log" to get all global revisions of interest. std::vector<std::string> svn_log; - svn_log.push_back("log"); - svn_log.push_back("--xml"); - svn_log.push_back("-v"); - svn_log.push_back(revs.c_str()); - svn_log.push_back(svninfo.LocalPath.c_str()); + svn_log.emplace_back("log"); + svn_log.emplace_back("--xml"); + svn_log.emplace_back("-v"); + svn_log.emplace_back(revs); + svn_log.emplace_back(svninfo.LocalPath); LogParser out(this, "log-out> ", svninfo); OutputLogger err(this->Log, "log-err> "); return this->RunSVNCommand(svn_log, &out, &err); @@ -467,7 +467,7 @@ bool cmCTestSVN::LoadModifications() { // Run "svn status" which reports local modifications. std::vector<std::string> svn_status; - svn_status.push_back("status"); + svn_status.emplace_back("status"); StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); this->RunSVNCommand(svn_status, &out, &err); @@ -529,7 +529,7 @@ bool cmCTestSVN::LoadRepositories() // Run "svn status" to get the list of external repositories std::vector<std::string> svn_status; - svn_status.push_back("status"); + svn_status.emplace_back("status"); ExternalParser out(this, "external-out> "); OutputLogger err(this->Log, "external-err> "); return this->RunSVNCommand(svn_status, &out, &err); |