diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-26 09:38:08 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-04-29 20:49:05 (GMT) |
commit | 78e1454ea09e9c568578e26971d6cd45b7fa39c7 (patch) | |
tree | 654063944808576f9b56e6f358d894ab53f0b8ef /Source/cmDefinitions.cxx | |
parent | 818bf727c1eb4a500decb5856715a964c948242e (diff) | |
download | CMake-78e1454ea09e9c568578e26971d6cd45b7fa39c7.zip CMake-78e1454ea09e9c568578e26971d6cd45b7fa39c7.tar.gz CMake-78e1454ea09e9c568578e26971d6cd45b7fa39c7.tar.bz2 |
cmDefinitions: Replace ClosureKeys recursion with looping.
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r-- | Source/cmDefinitions.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 448ba9d..a6f46e2 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -131,22 +131,22 @@ std::set<std::string> cmDefinitions::ClosureKeys() const void cmDefinitions::ClosureKeys(std::set<std::string>& defined, std::set<std::string>& undefined) const { - // Consider local definitions. - for(MapType::const_iterator mi = this->Map.begin(); - mi != this->Map.end(); ++mi) + cmDefinitions const* up = this; + + while (up) { - // Use this key if it is not already set or unset. - if(defined.find(mi->first) == defined.end() && - undefined.find(mi->first) == undefined.end()) + // Consider local definitions. + for(MapType::const_iterator mi = up->Map.begin(); + mi != up->Map.end(); ++mi) { - std::set<std::string>& m = mi->second.Exists? defined : undefined; - m.insert(mi->first); + // Use this key if it is not already set or unset. + if(defined.find(mi->first) == defined.end() && + undefined.find(mi->first) == undefined.end()) + { + std::set<std::string>& m = mi->second.Exists? defined : undefined; + m.insert(mi->first); + } } - } - - // Traverse parents. - if(cmDefinitions const* up = this->Up) - { - up->ClosureKeys(defined, undefined); + up = up->Up; } } |