From a85b1dd2fcb46123bdcf86c2ecb97e5be0d4fc0c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 3 Apr 2024 14:41:43 +1100 Subject: [PATCH] Cleanup: avoid shadowing local variables --- .../blender/editors/gpencil_legacy/gpencil_weight_paint.cc | 5 +++-- source/blender/editors/interface/interface_ops.cc | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/gpencil_legacy/gpencil_weight_paint.cc b/source/blender/editors/gpencil_legacy/gpencil_weight_paint.cc index f950514c3a2..65a39f3e08d 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_weight_paint.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_weight_paint.cc @@ -286,7 +286,6 @@ static void gpencil_select_buffer_avg_weight_set(tGP_BrushWeightpaintData *gso) */ static bool *gpencil_vgroup_bone_deformed_map_get(Object *ob, const int defbase_tot) { - bDeformGroup *dg; bool *vgroup_bone_deformed; GHash *gh; int i; @@ -331,7 +330,9 @@ static bool *gpencil_vgroup_bone_deformed_map_get(Object *ob, const int defbase_ /* Mark vertex groups with reference in the bone hash table. */ vgroup_bone_deformed = static_cast( MEM_mallocN(sizeof(*vgroup_bone_deformed) * defbase_tot, __func__)); - for (dg = static_cast(defbase->first), i = 0; dg; dg = dg->next, i++) { + + i = 0; + LISTBASE_FOREACH_INDEX (bDeformGroup *, dg, defbase, i) { vgroup_bone_deformed[i] = (BLI_ghash_lookup(gh, dg->name) != nullptr); } diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc index 4837cf62875..97da819bf7f 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1262,8 +1262,8 @@ bool UI_context_copy_to_selected_list(bContext *C, /* de-duplicate obdata */ if (!lb.is_empty()) { - for (const PointerRNA &ptr : lb) { - Object *ob = (Object *)ptr.owner_id; + for (const PointerRNA &ob_ptr : lb) { + Object *ob = (Object *)ob_ptr.owner_id; if (ID *id_data = static_cast(ob->data)) { id_data->tag |= LIB_TAG_DOIT; }