[Bf-blender-cvs] [e1c0d185985] master: Cleanup: remove redundant has key checks

Campbell Barton noreply at git.blender.org
Mon Jun 27 09:25:49 CEST 2022


Commit: e1c0d18598546040b2c5f130d720d45d38639910
Author: Campbell Barton
Date:   Mon Jun 27 17:20:21 2022 +1000
Branches: master
https://developer.blender.org/rBe1c0d18598546040b2c5f130d720d45d38639910

Cleanup: remove redundant has key checks

===================================================================

M	source/blender/editors/screen/screen_context.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c

===================================================================

diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 11a62123ad7..fe69759481b 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -1024,9 +1024,8 @@ static eContextResult screen_ctx_sel_actions_impl(const bContext *C,
         }
 
         /* Add the action to the output list if not already added. */
-        if (!BLI_gset_haskey(seen_set, action)) {
+        if (BLI_gset_add(seen_set, action)) {
           CTX_data_id_list_add(result, &action->id);
-          BLI_gset_add(seen_set, action);
         }
       }
     }
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index fbf988d63e8..9648f558049 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -1864,10 +1864,8 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
   /* Add new Face Sets IDs to the snapping gset if enabled. */
   if (expand_cache->snap) {
     const int active_face_set_id = sculpt_expand_active_face_set_id_get(ss, expand_cache);
-    if (!BLI_gset_haskey(expand_cache->snap_enabled_face_sets,
-                         POINTER_FROM_INT(active_face_set_id))) {
-      BLI_gset_add(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(active_face_set_id));
-    }
+    /* The key may exist, in that case this does nothing. */
+    BLI_gset_add(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(active_face_set_id));
   }
 
   /* Update the sculpt data with the current state of the #ExpandCache. */



More information about the Bf-blender-cvs mailing list