diff options
Diffstat (limited to 'source/blender/blenlib/intern/BLI_ghash.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 32818505e5c..9148e356e2a 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -30,6 +30,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include "BLI_ghash.h" #include "BLO_sys_types.h" // for intptr_t support /***/ @@ -89,7 +90,7 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef MEM_freeN(gh->buckets); BLI_mempool_destroy(gh->entrypool); - gh->buckets = 0; + gh->buckets = NULL; gh->nentries = 0; gh->nbuckets = 0; MEM_freeN(gh); @@ -149,17 +150,17 @@ int BLI_ghashIterator_isDone(GHashIterator *ghi) { /***/ -unsigned int BLI_ghashutil_ptrhash(void *key) { +unsigned int BLI_ghashutil_ptrhash(const void *key) { return (unsigned int)(intptr_t)key; } -int BLI_ghashutil_ptrcmp(void *a, void *b) { +int BLI_ghashutil_ptrcmp(const void *a, const void *b) { if (a==b) return 0; else return (a<b)?-1:1; } -unsigned int BLI_ghashutil_inthash(void *ptr) { +unsigned int BLI_ghashutil_inthash(const void *ptr) { uintptr_t key = (uintptr_t)ptr; key += ~(key << 16); @@ -172,15 +173,15 @@ unsigned int BLI_ghashutil_inthash(void *ptr) { return (unsigned int)(key & 0xffffffff); } -int BLI_ghashutil_intcmp(void *a, void *b) { +int BLI_ghashutil_intcmp(const void *a, const void *b) { if (a==b) return 0; else return (a<b)?-1:1; } -unsigned int BLI_ghashutil_strhash(void *ptr) { - char *s= ptr; +unsigned int BLI_ghashutil_strhash(const void *ptr) { + const char *s= ptr; unsigned int i= 0; unsigned char c; @@ -189,6 +190,6 @@ unsigned int BLI_ghashutil_strhash(void *ptr) { return i; } -int BLI_ghashutil_strcmp(void *a, void *b) { +int BLI_ghashutil_strcmp(const void *a, const void *b) { return strcmp(a, b); } |