From 385e6a274da286befb38a0d540845383f393b79f Mon Sep 17 00:00:00 2001 From: Stefano Soffia Date: Mon, 12 Sep 2016 23:01:50 +0200 Subject: [PATCH] cmLocalGenerator: Refactor test subdirectory generation loop --- Source/cmLocalGenerator.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c0ecba3e6..abe0c23a1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -175,15 +175,13 @@ void cmLocalGenerator::GenerateTestFiles() (*gi)->Compute(this); (*gi)->Generate(fout, config, configurationTypes); } - size_t i; - std::vector children = - this->Makefile->GetStateSnapshot().GetChildren(); - for (i = 0; i < children.size(); ++i) { + typedef std::vector vec_t; + vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren(); + for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { // TODO: Use add_subdirectory instead? - fout << "subdirs("; - std::string outP = children[i].GetDirectory().GetCurrentBinary(); - fout << this->ConvertToRelativePath(outP, START_OUTPUT); - fout << ")" << std::endl; + std::string outP = i->GetDirectory().GetCurrentBinary(); + outP = this->ConvertToRelativePath(outP, START_OUTPUT); + fout << "subdirs(" << outP << ")" << std::endl; } }