From ed0c1d5d4b30d03b26ff08841f6da2ddf44025a7 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Fri, 30 Dec 2022 18:07:46 +0000 Subject: patch 9.0.1115: code is indented more than needed Problem: Code is indented more than needed. Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan, closes #11758) --- src/ex_cmds.c | 152 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'src/ex_cmds.c') diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 693b0acace..faff4aadaf 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5413,56 +5413,55 @@ ex_drop(exarg_T *eap) // edited in a window yet. It's like ":tab all" but without closing // windows or tabs. ex_all(eap); + return; } - else - { - // ":drop file ...": Edit the first argument. Jump to an existing - // window if possible, edit in current window if the current buffer - // can be abandoned, otherwise open a new window. - buf = buflist_findnr(ARGLIST[0].ae_fnum); - FOR_ALL_TAB_WINDOWS(tp, wp) + // ":drop file ...": Edit the first argument. Jump to an existing + // window if possible, edit in current window if the current buffer + // can be abandoned, otherwise open a new window. + buf = buflist_findnr(ARGLIST[0].ae_fnum); + + FOR_ALL_TAB_WINDOWS(tp, wp) + { + if (wp->w_buffer == buf) { - if (wp->w_buffer == buf) + goto_tabpage_win(tp, wp); + curwin->w_arg_idx = 0; + if (!bufIsChanged(curbuf)) { - goto_tabpage_win(tp, wp); - curwin->w_arg_idx = 0; - if (!bufIsChanged(curbuf)) - { - int save_ar = curbuf->b_p_ar; + int save_ar = curbuf->b_p_ar; - // reload the file if it is newer - curbuf->b_p_ar = TRUE; - buf_check_timestamp(curbuf, FALSE); - curbuf->b_p_ar = save_ar; - } - return; + // reload the file if it is newer + curbuf->b_p_ar = TRUE; + buf_check_timestamp(curbuf, FALSE); + curbuf->b_p_ar = save_ar; } + return; } + } - /* - * Check whether the current buffer is changed. If so, we will need - * to split the current window or data could be lost. - * Skip the check if the 'hidden' option is set, as in this case the - * buffer won't be lost. - */ - if (!buf_hide(curbuf)) - { - ++emsg_off; - split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); - --emsg_off; - } + /* + * Check whether the current buffer is changed. If so, we will need + * to split the current window or data could be lost. + * Skip the check if the 'hidden' option is set, as in this case the + * buffer won't be lost. + */ + if (!buf_hide(curbuf)) + { + ++emsg_off; + split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); + --emsg_off; + } - // Fake a ":sfirst" or ":first" command edit the first argument. - if (split) - { - eap->cmdidx = CMD_sfirst; - eap->cmd[0] = 's'; - } - else - eap->cmdidx = CMD_first; - ex_rewind(eap); + // Fake a ":sfirst" or ":first" command edit the first argument. + if (split) + { + eap->cmdidx = CMD_sfirst; + eap->cmd[0] = 's'; } + else + eap->cmdidx = CMD_first; + ex_rewind(eap); } /* @@ -5556,53 +5555,54 @@ ex_oldfiles(exarg_T *eap UNUSED) char_u *fname; if (l == NULL) + { msg(_("No old files")); - else + return; + } + + msg_start(); + msg_scroll = TRUE; + for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) { - msg_start(); - msg_scroll = TRUE; - for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) + ++nr; + fname = tv_get_string(&li->li_tv); + if (!message_filtered(fname)) { - ++nr; - fname = tv_get_string(&li->li_tv); - if (!message_filtered(fname)) - { - msg_outnum((long)nr); - msg_puts(": "); - msg_outtrans(fname); - msg_clr_eos(); - msg_putchar('\n'); - out_flush(); // output one line at a time - ui_breakcheck(); - } + msg_outnum((long)nr); + msg_puts(": "); + msg_outtrans(fname); + msg_clr_eos(); + msg_putchar('\n'); + out_flush(); // output one line at a time + ui_breakcheck(); } + } - // Assume "got_int" was set to truncate the listing. - got_int = FALSE; + // Assume "got_int" was set to truncate the listing. + got_int = FALSE; # ifdef FEAT_BROWSE_CMD - if (cmdmod.cmod_flags & CMOD_BROWSE) + if (cmdmod.cmod_flags & CMOD_BROWSE) + { + quit_more = FALSE; + nr = prompt_for_number(FALSE); + msg_starthere(); + if (nr > 0) { - quit_more = FALSE; - nr = prompt_for_number(FALSE); - msg_starthere(); - if (nr > 0) - { - char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), - (long)nr); + char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), + (long)nr); - if (p != NULL) - { - p = expand_env_save(p); - eap->arg = p; - eap->cmdidx = CMD_edit; - cmdmod.cmod_flags &= ~CMOD_BROWSE; - do_exedit(eap, NULL); - vim_free(p); - } + if (p != NULL) + { + p = expand_env_save(p); + eap->arg = p; + eap->cmdidx = CMD_edit; + cmdmod.cmod_flags &= ~CMOD_BROWSE; + do_exedit(eap, NULL); + vim_free(p); } } -# endif } +# endif } #endif -- cgit v1.2.3