From 97c50a8dbd9f1ca5026f60e4a224e9a087e01f0e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 6 Apr 2015 12:30:21 +0200 Subject: [PATCH] cmMakefile: Simplify GetDefinitions implementation. --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 215ee1614..7f44da252 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2501,20 +2501,20 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const std::vector cmMakefile ::GetDefinitions(int cacheonly /* = 0 */) const { - std::set definitions; + std::vector res; if ( !cacheonly ) { - definitions = this->Internal->VarStack.top().ClosureKeys(); + std::set definitions = + this->Internal->VarStack.top().ClosureKeys(); + res.insert(res.end(), definitions.begin(), definitions.end()); } cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) { - definitions.insert(cit.GetName()); + res.push_back(cit.GetName()); } - - std::vector res; - res.insert(res.end(), definitions.begin(), definitions.end()); + std::sort(res.begin(), res.end()); return res; }