Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-03-02 03:12:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-03-02 03:18:56 +0300
commit0658659f74ad134bddbc982f7e1de0ff9b8bda66 (patch)
treee7a2ad5b5e63cc6dc7236e03e87148557121337f /source/blender/blenkernel/intern/icons.c
parentbac98199e956674473525bdb2504cf2e3b2c1417 (diff)
GHash: BLI_ghash_ensure_p_ex now takes a pointer-to-key arg
This is an alternative to passing a copy callback which is some times inconvenient. Instead the caller can write to the key - needed when the key is duplicated memory. Allows for minor optimization in ghash/gset use. Also add BLI_gset_ensure_p_ex
Diffstat (limited to 'source/blender/blenkernel/intern/icons.c')
-rw-r--r--source/blender/blenkernel/intern/icons.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 45ebada4d81..f3e86b44459 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -273,9 +273,10 @@ PreviewImage *BKE_previewimg_cached_get(const char *name)
PreviewImage *BKE_previewimg_cached_ensure(const char *name)
{
PreviewImage *prv = NULL;
- void **prv_p;
+ void **key_p, **prv_p;
- if (!BLI_ghash_ensure_p_ex(gCachedPreviews, name, &prv_p, (GHashKeyCopyFP)BLI_strdup)) {
+ if (!BLI_ghash_ensure_p_ex(gCachedPreviews, name, &key_p, &prv_p)) {
+ *key_p = BLI_strdup(name);
*prv_p = BKE_previewimg_create();
}
prv = *prv_p;