cmDefinitions: Avoid a find-then-insert when setting variables
Searching the map is not necessary.
This commit is contained in:
parent
5abfde6cb8
commit
3b21705d53
@ -50,16 +50,7 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def)
|
|||||||
if(this->Up || def.Exists)
|
if(this->Up || def.Exists)
|
||||||
{
|
{
|
||||||
// In lower scopes we store keys, defined or not.
|
// In lower scopes we store keys, defined or not.
|
||||||
MapType::iterator i = this->Map.find(key);
|
return (this->Map[key] = def);
|
||||||
if(i == this->Map.end())
|
|
||||||
{
|
|
||||||
i = this->Map.insert(MapType::value_type(key, def)).first;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i->second = def;
|
|
||||||
}
|
|
||||||
return i->second;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user