diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-11-22 10:00:45 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-01-11 16:00:55 (GMT) |
commit | 238dd2fbab1bd4fb53a25dcd07c1ee41da46d451 (patch) | |
tree | 2ad1d3c2057e6d568fb55da0a9b872f992cb06d6 /Source/CTest | |
parent | 2f7ef7e38d7aad93f5d25efb4fd7f61468cf06a2 (diff) | |
download | CMake-238dd2fbab1bd4fb53a25dcd07c1ee41da46d451.zip CMake-238dd2fbab1bd4fb53a25dcd07c1ee41da46d451.tar.gz CMake-238dd2fbab1bd4fb53a25dcd07c1ee41da46d451.tar.bz2 |
Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector.
A follow up change can use insert for inserting into a set.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestP4.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 18 |
4 files changed, 9 insertions, 29 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index d226a6c..5e7d764 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -1094,11 +1094,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, { // Create a contiguous array for the line this->CurrentProcessingLine.clear(); - t_BuildProcessingQueueType::iterator cit; - for ( cit = queue->begin(); cit != it; ++cit ) - { - this->CurrentProcessingLine.push_back(*cit); - } + this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(), + queue->begin(), queue->end()); this->CurrentProcessingLine.push_back(0); const char* line = &*this->CurrentProcessingLine.begin(); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 4c89caa..97637ed 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -526,11 +526,8 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() TestList sortedCopy; - for(TestSet::const_iterator j = currentSet.begin(); - j != currentSet.end(); ++j) - { - sortedCopy.push_back(*j); - } + sortedCopy.insert(sortedCopy.end(), + currentSet.begin(), currentSet.end()); std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp); diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 0bb1a99..52b98d7 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -349,11 +349,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions) std::vector<std::string> args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) - { - P4Options.push_back(*ai); - } + P4Options.insert(P4Options.end(), args.begin(), args.end()); } CommandOptions.clear(); diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 07a994d..4aa8d04 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -74,13 +74,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() std::vector<std::string> notesFiles; cmCTest::VectorOfStrings newNotesFiles; cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles); - std::vector<std::string>::iterator it; - for ( it = notesFiles.begin(); - it != notesFiles.end(); - ++ it ) - { - newNotesFiles.push_back(*it); - } + newNotesFiles.insert(newNotesFiles.end(), + notesFiles.begin(), notesFiles.end()); this->CTest->GenerateNotesFile(newNotesFiles); } @@ -91,13 +86,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() std::vector<std::string> extraFiles; cmCTest::VectorOfStrings newExtraFiles; cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles); - std::vector<std::string>::iterator it; - for ( it = extraFiles.begin(); - it != extraFiles.end(); - ++ it ) - { - newExtraFiles.push_back(*it); - } + newExtraFiles.insert(newExtraFiles.end(), + extraFiles.begin(), extraFiles.end()); if ( !this->CTest->SubmitExtraFiles(newExtraFiles)) { this->SetError("problem submitting extra files."); |