[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10819] branches/soc-2007-maike/source/ blender/blenlib/intern/BLI_ghash.c: Added BLI_ghash_lookup_reset(GHash *gh, void *key):
Miguel Torres Lima
torreslima at gmail.com
Wed May 30 16:59:01 CEST 2007
Revision: 10819
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10819
Author: maike
Date: 2007-05-30 16:59:00 +0200 (Wed, 30 May 2007)
Log Message:
-----------
Added BLI_ghash_lookup_reset(GHash *gh, void *key):
- returns value and sets key to NULL
Modified Paths:
--------------
branches/soc-2007-maike/source/blender/blenlib/intern/BLI_ghash.c
Modified: branches/soc-2007-maike/source/blender/blenlib/intern/BLI_ghash.c
===================================================================
--- branches/soc-2007-maike/source/blender/blenlib/intern/BLI_ghash.c 2007-05-30 14:54:50 UTC (rev 10818)
+++ branches/soc-2007-maike/source/blender/blenlib/intern/BLI_ghash.c 2007-05-30 14:59:00 UTC (rev 10819)
@@ -128,6 +128,19 @@
return NULL;
}
+void* BLI_ghash_lookup_reset(GHash *gh, void *key) {
+ unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+ Entry *e;
+
+ for (e= gh->buckets[hash]; e; e= e->next)
+ if (gh->cmpfp(key, e->key)==0){
+ e->key = NULL;
+ return e->val;
+ }
+
+ return NULL;
+}
+
int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
{
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
More information about the Bf-blender-cvs
mailing list