Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
31727:2b50a7f0feec | 31728:238ca27dbfd2 |
---|---|
3097 char_u **cmds = parmp->pre_commands; | 3097 char_u **cmds = parmp->pre_commands; |
3098 int cnt = parmp->n_pre_commands; | 3098 int cnt = parmp->n_pre_commands; |
3099 int i; | 3099 int i; |
3100 ESTACK_CHECK_DECLARATION | 3100 ESTACK_CHECK_DECLARATION |
3101 | 3101 |
3102 if (cnt > 0) | 3102 if (cnt <= 0) |
3103 { | 3103 return; |
3104 curwin->w_cursor.lnum = 0; // just in case.. | 3104 |
3105 estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0); | 3105 curwin->w_cursor.lnum = 0; // just in case.. |
3106 ESTACK_CHECK_SETUP | 3106 estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0); |
3107 ESTACK_CHECK_SETUP | |
3107 # ifdef FEAT_EVAL | 3108 # ifdef FEAT_EVAL |
3108 current_sctx.sc_sid = SID_CMDARG; | 3109 current_sctx.sc_sid = SID_CMDARG; |
3109 # endif | 3110 # endif |
3110 for (i = 0; i < cnt; ++i) | 3111 for (i = 0; i < cnt; ++i) |
3111 do_cmdline_cmd(cmds[i]); | 3112 do_cmdline_cmd(cmds[i]); |
3112 ESTACK_CHECK_NOW | 3113 ESTACK_CHECK_NOW |
3113 estack_pop(); | 3114 estack_pop(); |
3114 # ifdef FEAT_EVAL | 3115 # ifdef FEAT_EVAL |
3115 current_sctx.sc_sid = 0; | 3116 current_sctx.sc_sid = 0; |
3116 # endif | 3117 # endif |
3117 TIME_MSG("--cmd commands"); | 3118 TIME_MSG("--cmd commands"); |
3118 } | |
3119 } | 3119 } |
3120 | 3120 |
3121 /* | 3121 /* |
3122 * Execute "+", "-c" and "-S" arguments. | 3122 * Execute "+", "-c" and "-S" arguments. |
3123 */ | 3123 */ |
3367 char_u *initstr; | 3367 char_u *initstr; |
3368 sctx_T save_current_sctx; | 3368 sctx_T save_current_sctx; |
3369 | 3369 |
3370 ESTACK_CHECK_DECLARATION | 3370 ESTACK_CHECK_DECLARATION |
3371 | 3371 |
3372 if ((initstr = mch_getenv(env)) != NULL && *initstr != NUL) | 3372 if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL) |
3373 { | 3373 return FAIL; |
3374 if (is_viminit) | 3374 |
3375 vimrc_found(NULL, NULL); | 3375 if (is_viminit) |
3376 estack_push(ETYPE_ENV, env, 0); | 3376 vimrc_found(NULL, NULL); |
3377 ESTACK_CHECK_SETUP | 3377 estack_push(ETYPE_ENV, env, 0); |
3378 ESTACK_CHECK_SETUP | |
3378 save_current_sctx = current_sctx; | 3379 save_current_sctx = current_sctx; |
3379 current_sctx.sc_version = 1; | 3380 current_sctx.sc_version = 1; |
3380 #ifdef FEAT_EVAL | 3381 #ifdef FEAT_EVAL |
3381 current_sctx.sc_sid = SID_ENV; | 3382 current_sctx.sc_sid = SID_ENV; |
3382 current_sctx.sc_seq = 0; | 3383 current_sctx.sc_seq = 0; |
3383 current_sctx.sc_lnum = 0; | 3384 current_sctx.sc_lnum = 0; |
3384 #endif | 3385 #endif |
3385 | 3386 |
3386 do_cmdline_cmd(initstr); | 3387 do_cmdline_cmd(initstr); |
3387 | 3388 |
3388 ESTACK_CHECK_NOW | 3389 ESTACK_CHECK_NOW |
3389 estack_pop(); | 3390 estack_pop(); |
3390 current_sctx = save_current_sctx; | 3391 current_sctx = save_current_sctx; |
3391 return OK; | 3392 return OK; |
3392 } | |
3393 return FAIL; | |
3394 } | 3393 } |
3395 | 3394 |
3396 #if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) | 3395 #if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) |
3397 /* | 3396 /* |
3398 * Return TRUE if we are certain the user owns the file "fname". | 3397 * Return TRUE if we are certain the user owns the file "fname". |