diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-11 02:27:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-11 02:27:05 +0300 |
commit | 9e2e85a36777098ea97f63a183d9e715a9d703d6 (patch) | |
tree | 58bacac9854a9f1ef713c68349383436481fe6b4 /source/blender/blenlib/BLI_ghash.h | |
parent | d55868c3b2004cba008e21f5607dc08076594451 (diff) |
GHash: Add BLI_ghash_ensure_p_ex to copy the key
Needed in cases where the memory from each key is owned by the GHash.
Diffstat (limited to 'source/blender/blenlib/BLI_ghash.h')
-rw-r--r-- | source/blender/blenlib/BLI_ghash.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index a5c397f32f0..f5cc6c6b90c 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -44,8 +44,8 @@ typedef unsigned int (*GHashHashFP) (const void *key); typedef bool (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); typedef void (*GHashValFreeFP) (void *val); -typedef void *(*GHashKeyCopyFP) (void *key); -typedef void *(*GHashValCopyFP) (void *val); +typedef void *(*GHashKeyCopyFP) (const void *key); +typedef void *(*GHashValCopyFP) (const void *val); typedef struct GHash GHash; @@ -80,6 +80,7 @@ void *BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; void *BLI_ghash_lookup_default(GHash *gh, const void *key, void *val_default) ATTR_WARN_UNUSED_RESULT; void **BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; bool BLI_ghash_ensure_p(GHash *gh, void *key, void ***r_val) ATTR_WARN_UNUSED_RESULT; +bool BLI_ghash_ensure_p_ex(GHash *gh, const void *key, void ***r_val, GHashKeyCopyFP keycopyfp) ATTR_WARN_UNUSED_RESULT; bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); void BLI_ghash_clear_ex(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp, |