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/bmesh | |
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/bmesh')
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide_edgering.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c index 0e619b4cece..b5a95ad6283 100644 --- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c +++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c @@ -258,11 +258,10 @@ static GSet *bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim) if (pair_test.first > pair_test.second) SWAP(const void *, pair_test.first, pair_test.second); - if (!BLI_gset_haskey(eloop_pair_gs, &pair_test)) { - GHashPair *pair = BLI_ghashutil_pairalloc(pair_test.first, pair_test.second); - BLI_gset_insert(eloop_pair_gs, pair); + void **pair_key_p; + if (!BLI_gset_ensure_p_ex(eloop_pair_gs, &pair_test, &pair_key_p)) { + *pair_key_p = BLI_ghashutil_pairalloc(pair_test.first, pair_test.second); } - } } } |