diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-02 03:12:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-03-02 03:18:56 +0300 |
commit | 0658659f74ad134bddbc982f7e1de0ff9b8bda66 (patch) | |
tree | e7a2ad5b5e63cc6dc7236e03e87148557121337f /source/blender/imbuf/intern/indexer.c | |
parent | bac98199e956674473525bdb2504cf2e3b2c1417 (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/imbuf/intern/indexer.c')
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index a6012b1e88d..e1b3abcf2f6 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1167,12 +1167,13 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecod char filename[FILE_MAX]; get_proxy_filename(anim, proxy_size, filename, false); - if (BLI_gset_haskey(file_list, filename)) { - proxy_sizes_to_build &= ~proxy_size; - printf("Proxy: %s already registered for generation, skipping\n", filename); + void **filename_key_p; + if (!BLI_gset_ensure_p_ex(file_list, filename, &filename_key_p)) { + *filename_key_p = BLI_strdup(filename); } else { - BLI_gset_insert(file_list, BLI_strdup(filename)); + proxy_sizes_to_build &= ~proxy_size; + printf("Proxy: %s already registered for generation, skipping\n", filename); } } } |