ghash/edgehash flag wasn't being initialized for new hashes. also init vars in same order for ghash/edgehash.

This commit is contained in:
Campbell Barton 2013-08-21 20:21:42 +00:00
parent a31db0c7e9
commit 4dd9353e56
2 changed files with 9 additions and 5 deletions

@ -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;
}

@ -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);