diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-21 21:05:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-21 21:05:41 +0400 |
commit | 8bf5ec4f8af5d2129387d29dd2b552ec3b1850ca (patch) | |
tree | ec187676f9a60ddf3f5ac1802991da13c02ccca4 /source/blender/blenlib | |
parent | cfc13e179a47c9ba9985dbf745e17e9057f6592e (diff) |
code cleanup: de-duplicate BLI_ghashIterator_new/init and disable unused text undo print function.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index d30d3f3d256..10b3c01d274 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -34,6 +34,7 @@ #include <string.h> #include <stdlib.h> +#include <limits.h> #include "MEM_guardedalloc.h" @@ -255,22 +256,14 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef GHashIterator *BLI_ghashIterator_new(GHash *gh) { GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator"); - ghi->gh = gh; - ghi->curEntry = NULL; - ghi->curBucket = (unsigned int)-1; - while (!ghi->curEntry) { - ghi->curBucket++; - if (ghi->curBucket == ghi->gh->nbuckets) - break; - ghi->curEntry = ghi->gh->buckets[ghi->curBucket]; - } + BLI_ghashIterator_init(ghi, gh); return ghi; } void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) { ghi->gh = gh; ghi->curEntry = NULL; - ghi->curBucket = (unsigned int)-1; + ghi->curBucket = UINT_MAX; /* wraps to zero */ while (!ghi->curEntry) { ghi->curBucket++; if (ghi->curBucket == ghi->gh->nbuckets) |