diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-17 05:56:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-17 05:56:58 +0300 |
commit | e2c5439cb4eb423373750dae0dec8c5db3912b88 (patch) | |
tree | 44fa41d356e3b6963e7af82d7fff5241a279a9ab /source/blender/editors/screen/workspace_layout_edit.c | |
parent | 20276e4b00a228ab2ef80e58cc0171cec811015a (diff) |
Cleanup: Reduce variable scope in screen directory
Also return early and use LISTBASE_FOREACH in a few places
Diffstat (limited to 'source/blender/editors/screen/workspace_layout_edit.c')
-rw-r--r-- | source/blender/editors/screen/workspace_layout_edit.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c index f4b076aca00..31ca11bb847 100644 --- a/source/blender/editors/screen/workspace_layout_edit.c +++ b/source/blender/editors/screen/workspace_layout_edit.c @@ -61,11 +61,9 @@ WorkSpaceLayout *ED_workspace_layout_duplicate(Main *bmain, { bScreen *screen_old = BKE_workspace_layout_screen_get(layout_old); const char *name = BKE_workspace_layout_name_get(layout_old); - bScreen *screen_new; - WorkSpaceLayout *layout_new; - layout_new = ED_workspace_layout_add(bmain, workspace, win, name); - screen_new = BKE_workspace_layout_screen_get(layout_new); + WorkSpaceLayout *layout_new = ED_workspace_layout_add(bmain, workspace, win, name); + bScreen *screen_new = BKE_workspace_layout_screen_get(layout_new); if (BKE_screen_is_fullscreen_area(screen_old)) { LISTBASE_FOREACH (ScrArea *, area_old, &screen_old->areabase) { @@ -229,7 +227,6 @@ bool ED_workspace_layout_cycle(WorkSpace *workspace, const short direction, bCon { wmWindow *win = CTX_wm_window(C); WorkSpaceLayout *old_layout = BKE_workspace_active_layout_get(win->workspace_hook); - WorkSpaceLayout *new_layout; const bScreen *old_screen = BKE_workspace_layout_screen_get(old_layout); ScrArea *area = CTX_wm_area(C); @@ -238,11 +235,12 @@ bool ED_workspace_layout_cycle(WorkSpace *workspace, const short direction, bCon } BLI_assert(ELEM(direction, 1, -1)); - new_layout = BKE_workspace_layout_iter_circular(workspace, - old_layout, - workspace_layout_cycle_iter_cb, - NULL, - (direction == -1) ? true : false); + WorkSpaceLayout *new_layout = BKE_workspace_layout_iter_circular(workspace, + old_layout, + workspace_layout_cycle_iter_cb, + NULL, + (direction == -1) ? true : + false); if (new_layout && (old_layout != new_layout)) { bScreen *new_screen = BKE_workspace_layout_screen_get(new_layout); |