diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-30 23:13:38 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-01 17:44:35 (GMT) |
commit | a7ce0c7bc03efcfff6bf9fecc52663409262d73d (patch) | |
tree | 396a918ceb76b5043427a17f5ece9cd2e2960b4a /Source/cmDefinitions.cxx | |
parent | 7a5039fa6c0d84d1f4062211afcf0318db77f325 (diff) | |
download | CMake-a7ce0c7bc03efcfff6bf9fecc52663409262d73d.zip CMake-a7ce0c7bc03efcfff6bf9fecc52663409262d73d.tar.gz CMake-a7ce0c7bc03efcfff6bf9fecc52663409262d73d.tar.bz2 |
cmDefinitions: Make GetInternal method static.
For some reason, using recursion here is faster to configure ParaView
than using a loop. Probably some compiler optimization is inhibited
by using a loop.
Co-Author: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r-- | Source/cmDefinitions.cxx | 18 |
1 files changed, 9 insertions, 9 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; } |