Fix key resetting.

Make sure we don't add a new key-pair when the key already exists, and if
the existing value has the same pointer as the "new" value, do nothing.
This commit is contained in:
Bill Currie 2010-10-10 18:47:27 +09:00
parent 694a405578
commit 6702f04b46

View file

@ -175,8 +175,11 @@ vec3_t bad_maxs = {8, 8, 8};
for (e = epairs; e; e = e->next) {
if (!strcmp (k, e->key)) {
if (e->value == v)
return;
free (e->value);
e->value = strdup (v);
return;
}
}