Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/data Modified Files: evas_hash.c Log Message: an xrender engine. fully complete - but it doesnt support shaped window masks and destination alpha like software_x11 does so its not a 100% dropin replacement... yet =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/data/evas_hash.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- evas_hash.c 18 Jun 2005 01:00:30 -0000 1.11 +++ evas_hash.c 2 Oct 2005 15:15:44 -0000 1.12 @@ -208,14 +208,8 @@ { if (l != hash->buckets[hash_num]) { - /* FIXME: move to front of list without alloc */ hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el); hash->buckets[hash_num] = evas_object_list_prepend(hash->buckets[hash_num], el); - if (evas_list_alloc_error()) - { - _evas_hash_alloc_error = 1; - return el->data; - } } return el->data; } @@ -224,6 +218,47 @@ } /** + * Modifies the entry pointer at the specified key and returns the old entry + * @param hash The given hash table. + * @param key The key string of the entry to modify. + * @param data The data to replace the old entry, if it exists. + * @return The data pointer for the old stored entry, or @c NULL if not + * found. If an existing entry is not found, nothing is added to the + * hash. + * @ingroup Evas_Hash_Data + */ +void * +evas_hash_modify(Evas_Hash *hash, const char *key, const void *data) +{ + int hash_num; + Evas_Hash_El *el; + Evas_Object_List *l; + + _evas_hash_alloc_error = 0; + if (!hash) return NULL; + hash_num = evas_hash_gen(key); + for (l = hash->buckets[hash_num]; l; l = l->next) + { + el = (Evas_Hash_El *)l; + if (((el->key) && (key) && (!strcmp(el->key, key))) || + ((!el->key) && (!key))) + { + void *old_data; + + if (l != hash->buckets[hash_num]) + { + hash->buckets[hash_num] = evas_object_list_remove(hash->buckets[hash_num], el); + hash->buckets[hash_num] = evas_object_list_prepend(hash->buckets[hash_num], el); + } + old_data = el->data; + el->data = data; + return old_data; + } + } + return NULL; +} + +/** * @defgroup Evas_Hash_General_Group Hash General Functions * * Miscellaneous functions that operate on hash objects. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs