diff options
author | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:15:01 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:27:46 +0300 |
commit | d138cbfb47e379edc1ee915a8c6ff65b01f000d6 (patch) | |
tree | f4773ecce897c32eaf75295dd5f6a8e730d471ed /source/blender/editors/interface/interface_panel.c | |
parent | b0c1184875d39abac4a65a5d20e263ea6d841009 (diff) |
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
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 10 |
1 files changed, 5 insertions, 5 deletions
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; } |