diff options
Diffstat (limited to 'source/blender/blenlib/BLI_ghash.h')
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 0e985184f7a..46c0f767b5f 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -40,13 +40,11 @@ extern "C" { #include <stdlib.h> #include <string.h> -#include "BKE_utildefines.h" - #include "BLI_mempool.h" #include "BLI_blenlib.h" -typedef unsigned int (*GHashHashFP) (void *key); -typedef int (*GHashCmpFP) (void *a, void *b); +typedef unsigned int (*GHashHashFP) (const void *key); +typedef int (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); typedef void (*GHashValFreeFP) (void *val); @@ -141,14 +139,14 @@ int BLI_ghashIterator_isDone (GHashIterator *ghi); /* *** */ -unsigned int BLI_ghashutil_ptrhash (void *key); -int BLI_ghashutil_ptrcmp (void *a, void *b); +unsigned int BLI_ghashutil_ptrhash (const void *key); +int BLI_ghashutil_ptrcmp (const void *a, const void *b); -unsigned int BLI_ghashutil_strhash (void *key); -int BLI_ghashutil_strcmp (void *a, void *b); +unsigned int BLI_ghashutil_strhash (const void *key); +int BLI_ghashutil_strcmp (const void *a, const void *b); -unsigned int BLI_ghashutil_inthash (void *ptr); -int BLI_ghashutil_intcmp(void *a, void *b); +unsigned int BLI_ghashutil_inthash (const void *ptr); +int BLI_ghashutil_intcmp(const void *a, const void *b); /*begin of macro-inlined functions*/ extern unsigned int hashsizes[]; @@ -190,7 +188,7 @@ BM_INLINE void BLI_ghash_insert(GHash *gh, void *key, void *val) { gh->buckets[hash]= e; if (++gh->nentries>(float)gh->nbuckets/2) { - Entry *e, **old= gh->buckets; + Entry **old= gh->buckets; int i, nold= gh->nbuckets; gh->nbuckets= hashsizes[++gh->cursize]; @@ -213,7 +211,7 @@ BM_INLINE void BLI_ghash_insert(GHash *gh, void *key, void *val) { } } -BM_INLINE void* BLI_ghash_lookup(GHash *gh, void *key) +BM_INLINE void* BLI_ghash_lookup(GHash *gh, const void *key) { if(gh) { unsigned int hash= gh->hashfp(key)%gh->nbuckets; |