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/space_action/action_draw.c | 2 +- source/blender/editors/space_action/action_select.c | 4 ++-- source/blender/editors/space_action/space_action.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_action') diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 605d239133a..52287b07b28 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -561,7 +561,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) /* Iterate over pointcaches on the active object, and draw each one's range. */ float y_offset = 0.0f; const float cache_draw_height = 4.0f * UI_DPI_FAC * U.pixelsize; - for (PTCacheID *pid = pidlist.first; pid; pid = pid->next) { + LISTBASE_FOREACH (PTCacheID *, pid, &pidlist) { if (timeline_cache_is_hidden_by_setting(saction, pid)) { continue; } diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 173c2f1b5dc..26c29d6cbe7 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -437,7 +437,7 @@ static void box_select_elem( ListBase anim_data = {NULL, NULL}; ANIM_animdata_filter(ac, &anim_data, ANIMFILTER_DATA_VISIBLE, ac->data, ac->datatype); - for (bAnimListElem *ale2 = anim_data.first; ale2; ale2 = ale2->next) { + LISTBASE_FOREACH (bAnimListElem *, ale2, &anim_data) { box_select_elem(sel_data, ale2, xmin, xmax, true); } @@ -675,7 +675,7 @@ static void region_select_elem(RegionSelectData *sel_data, bAnimListElem *ale, b ListBase anim_data = {NULL, NULL}; ANIM_animdata_filter(ac, &anim_data, ANIMFILTER_DATA_VISIBLE, ac->data, ac->datatype); - for (bAnimListElem *ale2 = anim_data.first; ale2; ale2 = ale2->next) { + LISTBASE_FOREACH (bAnimListElem *, ale2, &anim_data) { region_select_elem(sel_data, ale2, true); } diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index f3304a48cac..e92ea906237 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -563,7 +563,7 @@ static void action_listener(wmWindow *UNUSED(win), ED_area_tag_redraw(area); break; case ND_FRAME_RANGE: - for (ARegion *region = area->regionbase.first; region; region = region->next) { + LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { if (region->regiontype == RGN_TYPE_WINDOW) { Scene *scene = wmn->reference; region->v2d.tot.xmin = (float)(SFRA - 4); -- cgit v1.2.3