Commit 3b21705d authored by Ben Boeckel's avatar Ben Boeckel
Browse files

cmDefinitions: Avoid a find-then-insert when setting variables

Searching the map is not necessary.
parent 5abfde6c
......@@ -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
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment