diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-14 21:36:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-14 21:36:15 +0800 |
commit | 2065ce877ef81bcd66132bd26e75aa4d761dca12 (patch) | |
tree | 875ab83390eb34fc6d85b5b43c35600166eac56d /src/nvim/main.c | |
parent | d549734fb4792bcdb5395006538f7c6d856252e7 (diff) | |
download | rneovim-2065ce877ef81bcd66132bd26e75aa4d761dca12.tar.gz rneovim-2065ce877ef81bcd66132bd26e75aa4d761dca12.tar.bz2 rneovim-2065ce877ef81bcd66132bd26e75aa4d761dca12.zip |
vim-patch:partial:9.0.1196: code is indented more than necessary (#21796)
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes vim/vim#11813)
https://github.com/vim/vim/commit/e8575988969579f9e1439181ae338b2ff74054a8
Partial port as this depends on some previous eval and 'smoothscroll'
patches.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r-- | src/nvim/main.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 237ffef9ea..6f14a00949 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1828,17 +1828,19 @@ static void exe_pre_commands(mparm_T *parmp) int cnt = parmp->n_pre_commands; int i; - if (cnt > 0) { - curwin->w_cursor.lnum = 0; // just in case.. - estack_push(ETYPE_ARGS, _("pre-vimrc command line"), 0); - current_sctx.sc_sid = SID_CMDARG; - for (i = 0; i < cnt; i++) { - do_cmdline_cmd(cmds[i]); - } - estack_pop(); - current_sctx.sc_sid = 0; - TIME_MSG("--cmd commands"); + if (cnt <= 0) { + return; + } + + curwin->w_cursor.lnum = 0; // just in case.. + estack_push(ETYPE_ARGS, _("pre-vimrc command line"), 0); + current_sctx.sc_sid = SID_CMDARG; + for (i = 0; i < cnt; i++) { + do_cmdline_cmd(cmds[i]); } + estack_pop(); + current_sctx.sc_sid = 0; + TIME_MSG("--cmd commands"); } // Execute "+", "-c" and "-S" arguments. @@ -2079,19 +2081,20 @@ static int execute_env(char *env) FUNC_ATTR_NONNULL_ALL { const char *initstr = os_getenv(env); - if (initstr != NULL) { - estack_push(ETYPE_ENV, env, 0); - const sctx_T save_current_sctx = current_sctx; - current_sctx.sc_sid = SID_ENV; - current_sctx.sc_seq = 0; - current_sctx.sc_lnum = 0; - do_cmdline_cmd((char *)initstr); - - estack_pop(); - current_sctx = save_current_sctx; - return OK; - } - return FAIL; + if (initstr == NULL) { + return FAIL; + } + + estack_push(ETYPE_ENV, env, 0); + const sctx_T save_current_sctx = current_sctx; + current_sctx.sc_sid = SID_ENV; + current_sctx.sc_seq = 0; + current_sctx.sc_lnum = 0; + do_cmdline_cmd((char *)initstr); + + estack_pop(); + current_sctx = save_current_sctx; + return OK; } /// Prints the following then exits: |