C++11: Update StringHashMap

This commit is contained in:
Arkshine 2014-12-06 12:21:48 +01:00
parent 590e6b1258
commit 1199863e47

View File

@ -149,9 +149,8 @@ public:
if (!i.found()) if (!i.found())
{ {
memory_used_ += key.length() + 1; memory_used_ += key.length() + 1;
if (!internal_.add(i)) if (!internal_.add(i, aKey))
return false; return false;
i->key = aKey;
} }
i->value = value; i->value = value;
return true; return true;
@ -163,11 +162,9 @@ public:
Insert i = internal_.findForAdd(key); Insert i = internal_.findForAdd(key);
if (i.found()) if (i.found())
return false; return false;
if (!internal_.add(i)) if (!internal_.add(i, aKey, value))
return false; return false;
memory_used_ += key.length() + 1; memory_used_ += key.length() + 1;
i->key = aKey;
i->value = value;
return true; return true;
} }
@ -225,9 +222,8 @@ public:
// Only value needs to be set after. // Only value needs to be set after.
bool add(Insert &i, const char *aKey) bool add(Insert &i, const char *aKey)
{ {
if (!internal_.add(i)) if (!internal_.add(i, aKey))
return false; return false;
i->key = aKey;
return true; return true;
} }