From 4dd9353e563ebe56fce0835d7a63ffb6454f73ab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Aug 2013 20:21:42 +0000 Subject: [PATCH] ghash/edgehash flag wasn't being initialized for new hashes. also init vars in same order for ghash/edgehash. --- source/blender/blenlib/intern/BLI_ghash.c | 8 +++++--- source/blender/blenlib/intern/edgehash.c | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 2a8dd795549..10a425ca12c 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -150,15 +150,17 @@ static void ghash_insert_ex(GHash *gh, void *key, void *val, GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { GHash *gh = MEM_mallocN(sizeof(*gh), info); + gh->hashfp = hashfp; gh->cmpfp = cmpfp; - gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0); - gh->cursize = 0; + gh->nbuckets = hashsizes[0]; /* gh->cursize */ gh->nentries = 0; - gh->nbuckets = hashsizes[gh->cursize]; + gh->cursize = 0; + gh->flag = 0; gh->buckets = MEM_callocN(gh->nbuckets * sizeof(*gh->buckets), "buckets"); + gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0); return gh; } diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index bac69183f0c..3263c69ee6a 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -160,9 +160,11 @@ static void edgehash_insert_ex(EdgeHash *eh, unsigned int v0, unsigned int v1, v EdgeHash *BLI_edgehash_new(void) { EdgeHash *eh = MEM_callocN(sizeof(*eh), "EdgeHash"); - eh->cursize = 0; + + eh->nbuckets = _ehash_hashsizes[0]; /* eh->cursize */ eh->nentries = 0; - eh->nbuckets = _ehash_hashsizes[eh->cursize]; + eh->cursize = 0; + eh->flag = 0; eh->buckets = MEM_callocN(eh->nbuckets * sizeof(*eh->buckets), "eh buckets 2"); eh->epool = BLI_mempool_create(sizeof(EdgeEntry), 512, 512, BLI_MEMPOOL_SYSMALLOC);