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 3f08268038
commit 670d9155e7

View file

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