diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-07-19 07:59:40 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-07-24 09:11:25 (GMT) |
commit | 451fd329a88f26bacce7e9939ef767876b385050 (patch) | |
tree | 58dcb7e252d5230349327f1d844b9033b324f10b /Source/cmDefinitions.cxx | |
parent | 1f618fae4db3ce8f22494559ef7ef64ae650b3f4 (diff) | |
download | CMake-451fd329a88f26bacce7e9939ef767876b385050.zip CMake-451fd329a88f26bacce7e9939ef767876b385050.tar.gz CMake-451fd329a88f26bacce7e9939ef767876b385050.tar.bz2 |
cmDefinitions: Cleanups
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r-- | Source/cmDefinitions.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 894447c..35cdc5a 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -13,10 +13,12 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, StackIter end, bool raise) { assert(begin != end); - MapType::iterator i = begin->Map.find(key); - if (i != begin->Map.end()) { - i->second.Used = true; - return i->second; + { + MapType::iterator it = begin->Map.find(key); + if (it != begin->Map.end()) { + it->second.Used = true; + return it->second; + } } StackIter it = begin; ++it; @@ -27,7 +29,7 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, if (!raise) { return def; } - return begin->Map.insert(MapType::value_type(key, def)).first->second; + return begin->Map.emplace(key, def).first->second; } const std::string* cmDefinitions::Get(const std::string& key, StackIter begin, @@ -47,8 +49,7 @@ bool cmDefinitions::HasKey(const std::string& key, StackIter begin, StackIter end) { for (StackIter it = begin; it != end; ++it) { - MapType::const_iterator i = it->Map.find(key); - if (i != it->Map.end()) { + if (it->Map.find(key) != it->Map.end()) { return true; } } @@ -97,8 +98,8 @@ cmDefinitions cmDefinitions::MakeClosure(StackIter begin, StackIter end) std::vector<std::string> cmDefinitions::ClosureKeys(StackIter begin, StackIter end) { - std::set<std::string> bound; std::vector<std::string> defined; + std::set<std::string> bound; for (StackIter it = begin; it != end; ++it) { defined.reserve(defined.size() + it->Map.size()); |