diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-18 04:36:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-18 04:36:04 +0400 |
commit | fbb446dff620c0719fd77692a0d401203ef1e966 (patch) | |
tree | c95104990f0da56ad6c5cd1d5ca4fb1ac4f277e7 /source/blender/blenlib/BLI_ghash.h | |
parent | 763bce4d64eeed978c6e84212da0f9c59ed32a4d (diff) |
add assert for hashes if an existing element is ever inserted into a ghash/edgehash.
the outliner does this intentionally, so add a flag to allow this situation optionally.
Diffstat (limited to 'source/blender/blenlib/BLI_ghash.h')
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 3ad0e18c8d7..d914c32664d 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -42,21 +42,7 @@ typedef int (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); typedef void (*GHashValFreeFP) (void *val); -typedef struct Entry { - struct Entry *next; - - void *key, *val; -} Entry; - -typedef struct GHash { - GHashHashFP hashfp; - GHashCmpFP cmpfp; - - Entry **buckets; - struct BLI_mempool *entrypool; - unsigned int nbuckets; - unsigned int nentries, cursize; -} GHash; +typedef struct GHash GHash; typedef struct GHashIterator { GHash *gh; @@ -64,6 +50,10 @@ typedef struct GHashIterator { struct Entry *curEntry; } GHashIterator; +enum { + GHASH_FLAG_ALLOW_DUPES = (1 << 0), /* only checked for in debug mode */ +}; + /* *** */ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info); @@ -75,6 +65,8 @@ void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfr void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp); bool BLI_ghash_haskey(GHash *gh, const void *key); int BLI_ghash_size(GHash *gh); +void BLI_ghash_flag_set(GHash *gh, unsigned short flag); +void BLI_ghash_flag_clear(GHash *gh, unsigned short flag); /* *** */ |