diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-14 13:11:58 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-14 13:11:58 (GMT) |
commit | 63f6fd144ef0171864ddeccee6618ab179e90384 (patch) | |
tree | 36c602ec8b47cef4b0b72929958c5c19846ffb1e /Source/CTest/cmCTestSVN.cxx | |
parent | 420874bfaa20772525c60b20d1ee5b6ef5ed9298 (diff) | |
download | CMake-63f6fd144ef0171864ddeccee6618ab179e90384.zip CMake-63f6fd144ef0171864ddeccee6618ab179e90384.tar.gz CMake-63f6fd144ef0171864ddeccee6618ab179e90384.tar.bz2 |
Meta: modernize old-fashioned loops to range-based `for` (CTest).
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
Diffstat (limited to 'Source/CTest/cmCTestSVN.cxx')
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 36582a2..5936d0e 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -103,10 +103,7 @@ bool cmCTestSVN::NoteOldRevision() return false; } - std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin(); - std::vector<SVNInfo>::iterator itend = this->Repositories.end(); - for (; itbeg != itend; itbeg++) { - SVNInfo& svninfo = *itbeg; + for (SVNInfo& svninfo : this->Repositories) { svninfo.OldRevision = this->LoadInfo(svninfo); this->Log << "Revision for repository '" << svninfo.LocalPath << "' before update: " << svninfo.OldRevision << "\n"; @@ -127,10 +124,7 @@ bool cmCTestSVN::NoteNewRevision() return false; } - std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin(); - std::vector<SVNInfo>::iterator itend = this->Repositories.end(); - for (; itbeg != itend; itbeg++) { - SVNInfo& svninfo = *itbeg; + for (SVNInfo& svninfo : this->Repositories) { svninfo.NewRevision = this->LoadInfo(svninfo); this->Log << "Revision for repository '" << svninfo.LocalPath << "' after update: " << svninfo.NewRevision << "\n"; @@ -257,9 +251,8 @@ bool cmCTestSVN::UpdateImpl() std::vector<char const*> svn_update; svn_update.push_back("update"); - for (std::vector<std::string>::const_iterator ai = args.begin(); - ai != args.end(); ++ai) { - svn_update.push_back(ai->c_str()); + for (std::string const& arg : args) { + svn_update.push_back(arg.c_str()); } UpdateParser out(this, "up-out> "); @@ -285,9 +278,8 @@ bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters, std::vector<std::string> parsedUserOptions = cmSystemTools::ParseArguments(userOptions.c_str()); - for (std::vector<std::string>::iterator i = parsedUserOptions.begin(); - i != parsedUserOptions.end(); ++i) { - args.push_back(i->c_str()); + for (std::string const& opt : parsedUserOptions) { + args.push_back(opt.c_str()); } args.push_back(nullptr); @@ -380,10 +372,7 @@ bool cmCTestSVN::LoadRevisions() { bool result = true; // Get revisions for all the external repositories - std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin(); - std::vector<SVNInfo>::iterator itend = this->Repositories.end(); - for (; itbeg != itend; itbeg++) { - SVNInfo& svninfo = *itbeg; + for (SVNInfo& svninfo : this->Repositories) { result = this->LoadRevisions(svninfo) && result; } return result; |