diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-06 13:03:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-06 13:41:37 +0300 |
commit | 26e50295ceb81bd09f65d30116f897ba53e50daf (patch) | |
tree | 12a283bb2144b6f198f63de1429ae4f35d426a52 /source/blender/blenlib | |
parent | dd129125b6f6c9fff5ef4423b221cf68fedbd188 (diff) |
Use BKE_ghash_ensure_p where possible
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/scanfill_utils.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index a606ac41aa1..d0420a30448 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -112,11 +112,13 @@ void BLI_scanfill_view3d_dump(ScanFillContext *sf_ctx) static ListBase *edge_isect_ls_ensure(GHash *isect_hash, ScanFillEdge *eed) { ListBase *e_ls; - e_ls = BLI_ghash_lookup(isect_hash, eed); - if (e_ls == NULL) { - e_ls = MEM_callocN(sizeof(ListBase), __func__); - BLI_ghash_insert(isect_hash, eed, e_ls); + void **val_p; + + if (!BLI_ghash_ensure_p(isect_hash, eed, &val_p)) { + *val_p = MEM_callocN(sizeof(ListBase), __func__); } + e_ls = *val_p; + return e_ls; } |