diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-02 00:13:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-02 02:15:22 +0300 |
commit | 8c620c8e2b3bf1f154f5d04e31e056bfc66d28df (patch) | |
tree | d28735e969c3fd7634d2e871b11dc4fcbd9ad259 /source/blender/blenkernel/intern/library_query.c | |
parent | d3940c2211463609d4fa2b8601c64b3f7744a1f8 (diff) |
Optimize ghash usage
Avoid double hash calculation.
Diffstat (limited to 'source/blender/blenkernel/intern/library_query.c')
-rw-r--r-- | source/blender/blenkernel/intern/library_query.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index f0f23eaa87d..6a9c1c82ab1 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -101,8 +101,7 @@ BLI_assert(*(id_pp) == old_id); \ } \ if (old_id && (_flag & IDWALK_RECURSE)) { \ - if (!BLI_gset_haskey((_data)->ids_handled, old_id)) { \ - BLI_gset_add((_data)->ids_handled, old_id); \ + if (BLI_gset_add((_data)->ids_handled, old_id)) { \ if (!(callback_return & IDWALK_RET_STOP_RECURSION)) { \ BLI_LINKSTACK_PUSH((_data)->ids_todo, old_id); \ } \ @@ -320,8 +319,7 @@ static void library_foreach_ID_as_subdata_link( if (flag & IDWALK_RECURSE) { /* Defer handling into main loop, recursively calling BKE_library_foreach_ID_link in IDWALK_RECURSE case is * troublesome, see T49553. */ - if (!BLI_gset_haskey(data->ids_handled, id)) { - BLI_gset_add(data->ids_handled, id); + if (BLI_gset_add(data->ids_handled, id)) { BLI_LINKSTACK_PUSH(data->ids_todo, id); } } |