and when deleting a hash item - if hash data != NULL delete EXACTLY that

entry (if there are duplicates... this will avoid removing the wrong one)



SVN revision: 36092
This commit is contained in:
Carsten Haitzler 2008-09-19 09:36:48 +00:00
parent c4624ffa93
commit bcabb2be60
1 changed files with 10 additions and 7 deletions

View File

@ -249,15 +249,18 @@ evas_hash_del(Evas_Hash *hash, const char *key, const void *data)
el = (Evas_Hash_El *)l; el = (Evas_Hash_El *)l;
if (!strcmp(el->key, key)) if (!strcmp(el->key, key))
{ {
hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el); if ((!data) || (el->data == data))
free(el);
hash->population--;
if (hash->population <= 0)
{ {
free(hash); hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el);
hash = NULL; free(el);
hash->population--;
if (hash->population <= 0)
{
free(hash);
hash = NULL;
}
return hash;
} }
return hash;
} }
} }
} }