0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1105: code is indented too much

Problem:    Code is indented too much.
Solution:   Use an early return. (Yegappan Lakshmanan, closes #11756)
This commit is contained in:
Yegappan Lakshmanan
2022-12-27 19:54:52 +00:00
committed by Bram Moolenaar
parent 56310d38d8
commit 87c1cbbe98
4 changed files with 194 additions and 189 deletions

View File

@@ -1270,9 +1270,12 @@ dict_extend_func(
return; return;
} }
d2 = argvars[1].vval.v_dict; d2 = argvars[1].vval.v_dict;
if ((is_new || !value_check_lock(d1->dv_lock, arg_errmsg, TRUE)) if (d2 == NULL)
&& d2 != NULL) return;
{
if (!is_new && value_check_lock(d1->dv_lock, arg_errmsg, TRUE))
return;
if (is_new) if (is_new)
{ {
d1 = dict_copy(d1, FALSE, TRUE, get_copyID()); d1 = dict_copy(d1, FALSE, TRUE, get_copyID());
@@ -1314,7 +1317,6 @@ dict_extend_func(
else else
copy_tv(&argvars[0], rettv); copy_tv(&argvars[0], rettv);
} }
}
/* /*
* Implementation of map() and filter() for a Dict. Apply "expr" to every * Implementation of map() and filter() for a Dict. Apply "expr" to every

View File

@@ -1664,8 +1664,9 @@ edit_putchar(int c, int highlight)
{ {
int attr; int attr;
if (ScreenLines != NULL) if (ScreenLines == NULL)
{ return;
update_topline(); // just in case w_topline isn't valid update_topline(); // just in case w_topline isn't valid
validate_cursor(); validate_cursor();
if (highlight) if (highlight)
@@ -1707,7 +1708,6 @@ edit_putchar(int c, int highlight)
} }
screen_putchar(c, pc_row, pc_col, attr); screen_putchar(c, pc_row, pc_col, attr);
} }
}
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) #if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
/* /*
@@ -1782,12 +1782,12 @@ display_dollar(colnr_T col_arg)
void void
undisplay_dollar(void) undisplay_dollar(void)
{ {
if (dollar_vcol >= 0) if (dollar_vcol < 0)
{ return;
dollar_vcol = -1; dollar_vcol = -1;
redrawWinline(curwin, curwin->w_cursor.lnum); redrawWinline(curwin, curwin->w_cursor.lnum);
} }
}
/* /*
* Truncate the space at the end of a line. This is to be used only in an * Truncate the space at the end of a line. This is to be used only in an
@@ -2554,8 +2554,9 @@ set_last_insert(int c)
vim_free(last_insert); vim_free(last_insert);
last_insert = alloc(MB_MAXBYTES * 3 + 5); last_insert = alloc(MB_MAXBYTES * 3 + 5);
if (last_insert != NULL) if (last_insert == NULL)
{ return;
s = last_insert; s = last_insert;
// Use the CTRL-V only when entering a special char // Use the CTRL-V only when entering a special char
if (c < ' ' || c == DEL) if (c < ' ' || c == DEL)
@@ -2565,7 +2566,6 @@ set_last_insert(int c)
*s++ = NUL; *s++ = NUL;
last_insert_skip = 0; last_insert_skip = 0;
} }
}
#if defined(EXITFREE) || defined(PROTO) #if defined(EXITFREE) || defined(PROTO)
void void

View File

@@ -128,8 +128,10 @@ fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, int skip)
{ {
init_evalarg(evalarg); init_evalarg(evalarg);
evalarg->eval_flags = skip ? 0 : EVAL_EVALUATE; evalarg->eval_flags = skip ? 0 : EVAL_EVALUATE;
if (eap != NULL)
{ if (eap == NULL)
return;
evalarg->eval_cstack = eap->cstack; evalarg->eval_cstack = eap->cstack;
if (sourcing_a_script(eap) || eap->getline == get_list_line) if (sourcing_a_script(eap) || eap->getline == get_list_line)
{ {
@@ -137,7 +139,6 @@ fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, int skip)
evalarg->eval_cookie = eap->cookie; evalarg->eval_cookie = eap->cookie;
} }
} }
}
/* /*
* Top level evaluation function, returning a boolean. * Top level evaluation function, returning a boolean.
@@ -404,8 +405,9 @@ init_evalarg(evalarg_T *evalarg)
static void static void
free_eval_tofree_later(evalarg_T *evalarg) free_eval_tofree_later(evalarg_T *evalarg)
{ {
if (evalarg->eval_tofree != NULL) if (evalarg->eval_tofree == NULL)
{ return;
if (ga_grow(&evalarg->eval_tofree_ga, 1) == OK) if (ga_grow(&evalarg->eval_tofree_ga, 1) == OK)
((char_u **)evalarg->eval_tofree_ga.ga_data) ((char_u **)evalarg->eval_tofree_ga.ga_data)
[evalarg->eval_tofree_ga.ga_len++] [evalarg->eval_tofree_ga.ga_len++]
@@ -413,7 +415,6 @@ free_eval_tofree_later(evalarg_T *evalarg)
else else
vim_free(evalarg->eval_tofree); vim_free(evalarg->eval_tofree);
} }
}
/* /*
* After using "evalarg" filled from "eap": free the memory. * After using "evalarg" filled from "eap": free the memory.
@@ -421,8 +422,9 @@ free_eval_tofree_later(evalarg_T *evalarg)
void void
clear_evalarg(evalarg_T *evalarg, exarg_T *eap) clear_evalarg(evalarg_T *evalarg, exarg_T *eap)
{ {
if (evalarg != NULL) if (evalarg == NULL)
{ return;
garray_T *etga = &evalarg->eval_tofree_ga; garray_T *etga = &evalarg->eval_tofree_ga;
if (evalarg->eval_tofree != NULL || evalarg->eval_using_cmdline) if (evalarg->eval_tofree != NULL || evalarg->eval_using_cmdline)
@@ -454,7 +456,6 @@ clear_evalarg(evalarg_T *evalarg, exarg_T *eap)
ga_clear_strings(etga); ga_clear_strings(etga);
VIM_CLEAR(evalarg->eval_tofree_lambda); VIM_CLEAR(evalarg->eval_tofree_lambda);
} }
}
/* /*
* Skip over an expression at "*pp". * Skip over an expression at "*pp".
@@ -3219,8 +3220,9 @@ eval_addblob(typval_T *tv1, typval_T *tv2)
blob_T *b = blob_alloc(); blob_T *b = blob_alloc();
int i; int i;
if (b != NULL) if (b == NULL)
{ return;
for (i = 0; i < blob_len(b1); i++) for (i = 0; i < blob_len(b1); i++)
ga_append(&b->bv_ga, blob_get(b1, i)); ga_append(&b->bv_ga, blob_get(b1, i));
for (i = 0; i < blob_len(b2); i++) for (i = 0; i < blob_len(b2); i++)
@@ -3229,7 +3231,6 @@ eval_addblob(typval_T *tv1, typval_T *tv2)
clear_tv(tv1); clear_tv(tv1);
rettv_blob_set(tv1, b); rettv_blob_set(tv1, b);
} }
}
/* /*
* Make a copy of list "tv1" and append list "tv2". * Make a copy of list "tv1" and append list "tv2".
@@ -4818,14 +4819,14 @@ f_slice(typval_T *argvars, typval_T *rettv)
|| check_for_opt_number_arg(argvars, 2) == FAIL)) || check_for_opt_number_arg(argvars, 2) == FAIL))
return; return;
if (check_can_index(argvars, TRUE, FALSE) == OK) if (check_can_index(argvars, TRUE, FALSE) != OK)
{ return;
copy_tv(argvars, rettv); copy_tv(argvars, rettv);
eval_index_inner(rettv, TRUE, argvars + 1, eval_index_inner(rettv, TRUE, argvars + 1,
argvars[2].v_type == VAR_UNKNOWN ? NULL : argvars + 2, argvars[2].v_type == VAR_UNKNOWN ? NULL : argvars + 2,
TRUE, NULL, 0, FALSE); TRUE, NULL, 0, FALSE);
} }
}
/* /*
* Apply index or range to "rettv". * Apply index or range to "rettv".
@@ -5045,8 +5046,9 @@ partial_free(partial_T *pt)
void void
partial_unref(partial_T *pt) partial_unref(partial_T *pt)
{ {
if (pt != NULL) if (pt == NULL)
{ return;
int done = FALSE; int done = FALSE;
if (--pt->pt_refcount <= 0) if (--pt->pt_refcount <= 0)
@@ -5072,7 +5074,6 @@ partial_unref(partial_T *pt)
} }
} }
} }
}
/* /*
* Return the next (unique) copy ID. * Return the next (unique) copy ID.
@@ -7225,11 +7226,13 @@ last_set_msg(sctx_T script_ctx)
{ {
char_u *p; char_u *p;
if (script_ctx.sc_sid != 0) if (script_ctx.sc_sid == 0)
{ return;
p = home_replace_save(NULL, get_scriptname(script_ctx.sc_sid)); p = home_replace_save(NULL, get_scriptname(script_ctx.sc_sid));
if (p != NULL) if (p == NULL)
{ return;
verbose_enter(); verbose_enter();
msg_puts(_("\n\tLast set from ")); msg_puts(_("\n\tLast set from "));
msg_puts((char *)p); msg_puts((char *)p);
@@ -7241,8 +7244,6 @@ last_set_msg(sctx_T script_ctx)
verbose_leave(); verbose_leave();
vim_free(p); vim_free(p);
} }
}
}
#endif // FEAT_EVAL #endif // FEAT_EVAL

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1105,
/**/ /**/
1104, 1104,
/**/ /**/