diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-01-14 12:32:28 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-14 12:32:28 +0000 |
commit | e8575988969579f9e1439181ae338b2ff74054a8 (patch) | |
tree | f4c8a1242cb67b073bb0e375740c764c2136af21 /src/main.c | |
parent | 378e6c03f98efc88e8c2675e05a548f9bb7889a1 (diff) |
patch 9.0.1196: code is indented more than necessaryv9.0.1196
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11813)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/main.c b/src/main.c index 0299c61a79..d1c42ed120 100644 --- a/src/main.c +++ b/src/main.c @@ -3099,23 +3099,23 @@ exe_pre_commands(mparm_T *parmp) int i; ESTACK_CHECK_DECLARATION - if (cnt > 0) - { - curwin->w_cursor.lnum = 0; // just in case.. - estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0); - ESTACK_CHECK_SETUP + if (cnt <= 0) + return; + + curwin->w_cursor.lnum = 0; // just in case.. + estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0); + ESTACK_CHECK_SETUP # ifdef FEAT_EVAL current_sctx.sc_sid = SID_CMDARG; # endif for (i = 0; i < cnt; ++i) do_cmdline_cmd(cmds[i]); - ESTACK_CHECK_NOW + ESTACK_CHECK_NOW estack_pop(); # ifdef FEAT_EVAL - current_sctx.sc_sid = 0; + current_sctx.sc_sid = 0; # endif - TIME_MSG("--cmd commands"); - } + TIME_MSG("--cmd commands"); } /* @@ -3369,28 +3369,27 @@ process_env( ESTACK_CHECK_DECLARATION - if ((initstr = mch_getenv(env)) != NULL && *initstr != NUL) - { - if (is_viminit) - vimrc_found(NULL, NULL); - estack_push(ETYPE_ENV, env, 0); - ESTACK_CHECK_SETUP + if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL) + return FAIL; + + if (is_viminit) + vimrc_found(NULL, NULL); + estack_push(ETYPE_ENV, env, 0); + ESTACK_CHECK_SETUP save_current_sctx = current_sctx; - current_sctx.sc_version = 1; + current_sctx.sc_version = 1; #ifdef FEAT_EVAL - current_sctx.sc_sid = SID_ENV; - current_sctx.sc_seq = 0; - current_sctx.sc_lnum = 0; + current_sctx.sc_sid = SID_ENV; + current_sctx.sc_seq = 0; + current_sctx.sc_lnum = 0; #endif - do_cmdline_cmd(initstr); + do_cmdline_cmd(initstr); - ESTACK_CHECK_NOW + ESTACK_CHECK_NOW estack_pop(); - current_sctx = save_current_sctx; - return OK; - } - return FAIL; + current_sctx = save_current_sctx; + return OK; } #if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) |