From d138cbfb47e379edc1ee915a8c6ff65b01f000d6 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 3 Apr 2020 19:15:01 +0200 Subject: Code Quality: Replace for loops with LISTBASE_FOREACH Note this only changes cases where the variable was declared inside the for loop. To handle it outside as well is a different challenge. Differential Revision: https://developer.blender.org/D7320 --- source/blender/editors/armature/armature_relations.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/armature/armature_relations.c') diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index c592287c967..644e466e904 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -569,7 +569,7 @@ static void separate_armature_bones(Main *bmain, Object *ob, const bool is_selec if (is_select == (EBONE_VISIBLE(arm, curbone) && (curbone->flag & BONE_SELECTED))) { /* clear the bone->parent var of any bone that had this as its parent */ - for (EditBone *ebo = arm->edbo->first; ebo; ebo = ebo->next) { + LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) { if (ebo->parent == curbone) { ebo->parent = NULL; /* this is needed to prevent random crashes with in ED_armature_from_edit */ @@ -579,7 +579,7 @@ static void separate_armature_bones(Main *bmain, Object *ob, const bool is_selec } /* clear the pchan->parent var of any pchan that had this as its parent */ - for (bPoseChannel *pchn = ob->pose->chanbase.first; pchn; pchn = pchn->next) { + LISTBASE_FOREACH (bPoseChannel *, pchn, &ob->pose->chanbase) { if (pchn->parent == pchan) { pchn->parent = NULL; } @@ -630,7 +630,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op) bArmature *arm_old = ob_old->data; bool has_selected_bone = false; bool has_selected_any = false; - for (EditBone *ebone = arm_old->edbo->first; ebone; ebone = ebone->next) { + LISTBASE_FOREACH (EditBone *, ebone, arm_old->edbo) { if (EBONE_VISIBLE(arm_old, ebone)) { if (ebone->flag & BONE_SELECTED) { has_selected_bone = true; @@ -836,7 +836,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) bool is_active_only_selected = false; if (actbone->flag & BONE_SELECTED) { is_active_only_selected = true; - for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) { + LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) { if (EBONE_EDITABLE(ebone) && (ebone->flag & BONE_SELECTED)) { if (ebone != actbone) { is_active_only_selected = false; @@ -868,7 +868,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) */ /* Parent selected bones to the active one. */ - for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) { + LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) { if (EBONE_EDITABLE(ebone) && (ebone->flag & BONE_SELECTED)) { if (ebone != actbone) { bone_connect_to_new_parent(arm->edbo, ebone, actbone, val); @@ -902,7 +902,7 @@ static int armature_parent_set_invoke(bContext *C, Object *ob = CTX_data_edit_object(C); bArmature *arm = ob->data; EditBone *actbone = arm->act_edbone; - for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) { + LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) { if (EBONE_EDITABLE(ebone) && (ebone->flag & BONE_SELECTED)) { if (ebone != actbone) { if (ebone->parent != actbone) { @@ -984,7 +984,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op) bArmature *arm = ob->data; bool changed = false; - for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) { + LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) { if (EBONE_EDITABLE(ebone)) { changed = true; break; -- cgit v1.2.3