From 3b21705d534c16a6197f28db68ea81e2816bfec3 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 12 Mar 2014 14:03:41 -0400 Subject: [PATCH] cmDefinitions: Avoid a find-then-insert when setting variables Searching the map is not necessary. --- Source/cmDefinitions.cxx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 98becf80d..650216379 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 {