diff options
-rw-r--r-- | Source/cmDefinitions.cxx | 18 | ||||
-rw-r--r-- | Source/cmDefinitions.h | 8 |
2 files changed, 12 insertions, 14 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index a429b6d..f54bc4d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -22,20 +22,20 @@ cmDefinitions::Def const& cmDefinitions::GetInternal( std::list<cmDefinitions>::reverse_iterator rbegin, std::list<cmDefinitions>::reverse_iterator rend) { - assert(&*rbegin == this); - MapType::const_iterator i = this->Map.find(key); - if(i != this->Map.end()) + assert(rbegin != rend); + MapType::const_iterator i = rbegin->Map.find(key); + if (i != rbegin->Map.end()) { return i->second; } - ++rbegin; - if(rbegin == rend) + std::list<cmDefinitions>::reverse_iterator rit = rbegin; + ++rit; + if (rit == rend) { return cmDefinitions::NoDef; } - // Query the parent scope and store the result locally. - Def def = rbegin->GetInternal(key, rbegin, rend); - return this->Map.insert(MapType::value_type(key, def)).first->second; + Def const& def = cmDefinitions::GetInternal(key, rit, rend); + return rbegin->Map.insert(MapType::value_type(key, def)).first->second; } //---------------------------------------------------------------------------- @@ -43,7 +43,7 @@ const char* cmDefinitions::Get(const std::string& key, std::list<cmDefinitions>::reverse_iterator rbegin, std::list<cmDefinitions>::reverse_iterator rend) { - Def const& def = this->GetInternal(key, rbegin, rend); + Def const& def = cmDefinitions::GetInternal(key, rbegin, rend); return def.Exists? def.c_str() : 0; } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 33f468b..77edbd0 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -73,11 +73,9 @@ private: #endif MapType Map; - // Internal query and update methods. - Def const& GetInternal(const std::string& key, - std::list<cmDefinitions>::reverse_iterator rbegin, - std::list<cmDefinitions>::reverse_iterator rend); - + static Def const& GetInternal(const std::string& key, + std::list<cmDefinitions>::reverse_iterator rbegin, + std::list<cmDefinitions>::reverse_iterator rend); void MakeClosure(std::set<std::string>& undefined, std::list<cmDefinitions>::const_reverse_iterator rbegin, std::list<cmDefinitions>::const_reverse_iterator rend); |