diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-22 00:21:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-22 00:21:42 +0400 |
commit | 4dd9353e563ebe56fce0835d7a63ffb6454f73ab (patch) | |
tree | 23c756ddacac7ab741dafb4c3dfdb8adf926b069 | |
parent | a31db0c7e929c480b3413f0688d7ec02203b3267 (diff) |
ghash/edgehash flag wasn't being initialized for new hashes. also init vars in same order for ghash/edgehash.
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 8 | ||||
-rw-r--r-- | 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); |