Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/data
Modified Files:
evas_hash.c
Log Message:
fix dfb engine - correctness changes for hash
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/data/evas_hash.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- evas_hash.c 6 Jan 2006 23:05:17 -0000 1.18
+++ evas_hash.c 16 Jan 2006 03:37:33 -0000 1.19
@@ -210,22 +210,48 @@
Evas_Object_List *l;
if (!hash) return NULL;
- hash_num = _evas_hash_gen(key);
- for (l = hash->buckets[hash_num]; l; l = l->next)
+ if (!key)
{
- el = (Evas_Hash_El *)l;
- if (((key) && (!strcmp(el->key, key))) ||
- ((!key) && (el->data == data)))
+ int hash_num;
+
+ for (hash_num = 0; hash_num < 256; hash_num++)
{
- hash->buckets[hash_num] =
evas_object_list_remove(hash->buckets[hash_num], el);
- free(el);
- hash->population--;
- if (hash->population <= 0)
+ for (l = hash->buckets[hash_num]; l; l = l->next)
+ {
+ el = (Evas_Hash_El *)l;
+ if (el->data == data)
+ {
+ hash->buckets[hash_num] =
evas_object_list_remove(hash->buckets[hash_num], el);
+ free(el);
+ hash->population--;
+ if (hash->population <= 0)
+ {
+ free(hash);
+ hash = NULL;
+ }
+ return hash;
+ }
+ }
+ }
+ }
+ else
+ {
+ hash_num = _evas_hash_gen(key);
+ for (l = hash->buckets[hash_num]; l; l = l->next)
+ {
+ el = (Evas_Hash_El *)l;
+ if (!strcmp(el->key, key))
{
- free(hash);
- hash = NULL;
+ hash->buckets[hash_num] =
evas_object_list_remove(hash->buckets[hash_num], el);
+ free(el);
+ hash->population--;
+ if (hash->population <= 0)
+ {
+ free(hash);
+ hash = NULL;
+ }
+ return hash;
}
- return hash;
}
}
return hash;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs