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>2015-04-06 13:03:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-04-06 13:41:37 +0300
commit26e50295ceb81bd09f65d30116f897ba53e50daf (patch)
tree12a283bb2144b6f198f63de1429ae4f35d426a52 /source/blender/blenkernel/intern/icons.c
parentdd129125b6f6c9fff5ef4423b221cf68fedbd188 (diff)
Use BKE_ghash_ensure_p where possible
Diffstat (limited to 'source/blender/blenkernel/intern/icons.c')
-rw-r--r--source/blender/blenkernel/intern/icons.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 8bda957f187..d3225f3fa35 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -311,16 +311,14 @@ Icon *BKE_icon_get(int icon_id)
void BKE_icon_set(int icon_id, struct Icon *icon)
{
- Icon *old_icon = NULL;
+ void **val_p;
- old_icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
-
- if (old_icon) {
+ if (BLI_ghash_ensure_p(gIcons, SET_INT_IN_POINTER(icon_id), &val_p)) {
printf("BKE_icon_set: Internal error, icon already set: %d\n", icon_id);
return;
}
- BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(icon_id), icon);
+ *val_p = icon;
}
void BKE_icon_delete(struct ID *id)