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/interface/interface_panel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/interface/interface_panel.c') diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 04d1181a8a1..42179452279 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -160,7 +160,7 @@ static int panel_aligned(const ScrArea *area, const ARegion *region) static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, bool *no_animation) { - for (Panel *pa = lb->first; pa; pa = pa->next) { + LISTBASE_FOREACH (Panel *, pa, lb) { /* Detect panel active flag changes. */ if (!(pa->type && pa->type->parent)) { if ((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE)) { @@ -394,7 +394,7 @@ void UI_panel_end( pa->blocksizey = height; /* Compute total panel size including children. */ - for (Panel *pachild = pa->children.first; pachild; pachild = pachild->next) { + LISTBASE_FOREACH (Panel *, pachild, &pa->children) { if (pachild->runtime_flag & PNL_ACTIVE) { width = max_ii(width, pachild->sizex); height += get_panel_real_size_y(pachild); @@ -441,7 +441,7 @@ static void ui_offset_panel_block(uiBlock *block) int ofsy = block->panel->sizey - style->panelspace; - for (uiBut *but = block->buttons.first; but; but = but->next) { + LISTBASE_FOREACH (uiBut *, but, &block->buttons) { but->rect.ymin += ofsy; but->rect.ymax += ofsy; } @@ -1006,7 +1006,7 @@ static void align_sub_panels(Panel *pa) /* Position sub panels. */ int ofsy = pa->ofsy + pa->sizey - pa->blocksizey; - for (Panel *pachild = pa->children.first; pachild; pachild = pachild->next) { + LISTBASE_FOREACH (Panel *, pachild, &pa->children) { if (pachild->runtime_flag & PNL_ACTIVE) { pachild->ofsx = pa->ofsx; pachild->ofsy = ofsy - get_panel_size_y(pachild); @@ -1200,7 +1200,7 @@ static void panel_list_clear_active(ListBase *lb) { /* set all panels as inactive, so that at the end we know * which ones were used */ - for (Panel *pa = lb->first; pa; pa = pa->next) { + LISTBASE_FOREACH (Panel *, pa, lb) { if (pa->runtime_flag & PNL_ACTIVE) { pa->runtime_flag = PNL_WAS_ACTIVE; } -- cgit v1.2.3