diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-03-12 18:03:41 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2014-06-09 18:46:45 (GMT) |
commit | 3b21705d534c16a6197f28db68ea81e2816bfec3 (patch) | |
tree | 963d4d69a796d4d8ee18f45aa3902a61d8f248ef | |
parent | 5abfde6cb8a1ae0b2825797eab6c2e9842eb7c49 (diff) | |
download | CMake-3b21705d534c16a6197f28db68ea81e2816bfec3.zip CMake-3b21705d534c16a6197f28db68ea81e2816bfec3.tar.gz CMake-3b21705d534c16a6197f28db68ea81e2816bfec3.tar.bz2 |
cmDefinitions: Avoid a find-then-insert when setting variables
Searching the map is not necessary.
-rw-r--r-- | Source/cmDefinitions.cxx | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 98becf8..6502163 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -50,16 +50,7 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def) if(this->Up || def.Exists) { // In lower scopes we store keys, defined or not. - MapType::iterator i = this->Map.find(key); - if(i == this->Map.end()) - { - i = this->Map.insert(MapType::value_type(key, def)).first; - } - else - { - i->second = def; - } - return i->second; + return (this->Map[key] = def); } else { |