diff options
author | Martin Poirier <theeth@yahoo.com> | 2008-05-27 17:22:17 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2008-05-27 17:22:17 +0400 |
commit | e70573badd22fc08b72c7c56f39293bc70d52c71 (patch) | |
tree | a5f60f7bd9507538ec70a6534932d6b5037bbfa5 /source/blender/blenlib/BLI_ghash.h | |
parent | 8676e9f44e8f5e1904bbeb12efec51a2061e656d (diff) |
gHash iterator initializer
To be able to have iterators on the stack/reuse iterators
Diffstat (limited to 'source/blender/blenlib/BLI_ghash.h')
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index aec77f5f385..c77e82f0a2b 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -34,7 +34,12 @@ struct GHash; typedef struct GHash GHash; -typedef struct GHashIterator GHashIterator; + +typedef struct GHashIterator { + GHash *gh; + int curBucket; + struct Entry *curEntry; +} GHashIterator; typedef unsigned int (*GHashHashFP) (void *key); typedef int (*GHashCmpFP) (void *a, void *b); @@ -63,6 +68,15 @@ int BLI_ghash_size (GHash *gh); */ GHashIterator* BLI_ghashIterator_new (GHash *gh); /** + * Init an already allocated GHashIterator. The hash table must not + * be mutated while the iterator is in use, and the iterator will + * step exactly BLI_ghash_size(gh) times before becoming done. + * + * @param ghi The GHashIterator to initialize. + * @param gh The GHash to iterate over. + */ +void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh); + /** * Free a GHashIterator. * * @param ghi The iterator to free. |