Mercurial > vim
diff src/main.c @ 31728:238ca27dbfd2 v9.0.1196
patch 9.0.1196: code is indented more than necessary
Commit: https://github.com/vim/vim/commit/e8575988969579f9e1439181ae338b2ff74054a8
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Jan 14 12:32:28 2023 +0000
patch 9.0.1196: code is indented more than necessary
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11813)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 14 Jan 2023 13:45:04 +0100 |
parents | 91924f1b59af |
children | baafb135b0cb |
line wrap: on
line diff
--- 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); - - ESTACK_CHECK_NOW + do_cmdline_cmd(initstr); + + 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)