summaryrefslogtreecommitdiffstats
path: root/Source/cmDefinitions.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-03-12 18:03:41 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-06-09 18:46:45 (GMT)
commit3b21705d534c16a6197f28db68ea81e2816bfec3 (patch)
tree963d4d69a796d4d8ee18f45aa3902a61d8f248ef /Source/cmDefinitions.cxx
parent5abfde6cb8a1ae0b2825797eab6c2e9842eb7c49 (diff)
downloadCMake-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.
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r--Source/cmDefinitions.cxx11
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
{