mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1098: code uses too much indent
Problem: Code uses too much indent. Solution: Use an early return. (Yegappan Lakshmanan, closes #11747)
This commit is contained in:
committed by
Bram Moolenaar
parent
b3d614369f
commit
465de3a57b
@@ -460,16 +460,17 @@ del_history_entry(int histype, char_u *str)
|
|||||||
int last;
|
int last;
|
||||||
int found = FALSE;
|
int found = FALSE;
|
||||||
|
|
||||||
regmatch.regprog = NULL;
|
if (hislen == 0 || histype < 0 || histype >= HIST_COUNT || *str == NUL
|
||||||
|
|| hisidx[histype] < 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
idx = hisidx[histype];
|
||||||
|
regmatch.regprog = vim_regcomp(str, RE_MAGIC + RE_STRING);
|
||||||
|
if (regmatch.regprog == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
regmatch.rm_ic = FALSE; // always match case
|
regmatch.rm_ic = FALSE; // always match case
|
||||||
if (hislen != 0
|
|
||||||
&& histype >= 0
|
|
||||||
&& histype < HIST_COUNT
|
|
||||||
&& *str != NUL
|
|
||||||
&& (idx = hisidx[histype]) >= 0
|
|
||||||
&& (regmatch.regprog = vim_regcomp(str, RE_MAGIC + RE_STRING))
|
|
||||||
!= NULL)
|
|
||||||
{
|
|
||||||
i = last = idx;
|
i = last = idx;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -495,9 +496,10 @@ del_history_entry(int histype, char_u *str)
|
|||||||
if (--i < 0)
|
if (--i < 0)
|
||||||
i += hislen;
|
i += hislen;
|
||||||
} while (i != idx);
|
} while (i != idx);
|
||||||
|
|
||||||
if (history[histype][idx].hisstr == NULL)
|
if (history[histype][idx].hisstr == NULL)
|
||||||
hisidx[histype] = -1;
|
hisidx[histype] = -1;
|
||||||
}
|
|
||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
@@ -682,8 +682,9 @@ ex_breakadd(exarg_T *eap)
|
|||||||
gap = &prof_ga;
|
gap = &prof_ga;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dbg_parsearg(eap->arg, gap) == OK)
|
if (dbg_parsearg(eap->arg, gap) != OK)
|
||||||
{
|
return;
|
||||||
|
|
||||||
bp = &DEBUGGY(gap, gap->ga_len);
|
bp = &DEBUGGY(gap, gap->ga_len);
|
||||||
bp->dbg_forceit = eap->forceit;
|
bp->dbg_forceit = eap->forceit;
|
||||||
|
|
||||||
@@ -720,7 +721,6 @@ ex_breakadd(exarg_T *eap)
|
|||||||
has_expr_breakpoint = TRUE;
|
has_expr_breakpoint = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ":debuggreedy".
|
* ":debuggreedy".
|
||||||
@@ -822,9 +822,11 @@ ex_breakdel(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (todel < 0)
|
if (todel < 0)
|
||||||
semsg(_(e_breakpoint_not_found_str), eap->arg);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
semsg(_(e_breakpoint_not_found_str), eap->arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (gap->ga_len > 0)
|
while (gap->ga_len > 0)
|
||||||
{
|
{
|
||||||
vim_free(DEBUGGY(gap, todel).dbg_name);
|
vim_free(DEBUGGY(gap, todel).dbg_name);
|
||||||
@@ -852,7 +854,6 @@ ex_breakdel(exarg_T *eap)
|
|||||||
if (gap == &dbg_breakp)
|
if (gap == &dbg_breakp)
|
||||||
update_has_expr_breakpoint();
|
update_has_expr_breakpoint();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ":breaklist".
|
* ":breaklist".
|
||||||
@@ -864,8 +865,11 @@ ex_breaklist(exarg_T *eap UNUSED)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dbg_breakp.ga_len == 0)
|
if (dbg_breakp.ga_len == 0)
|
||||||
|
{
|
||||||
msg(_("No breakpoints defined"));
|
msg(_("No breakpoints defined"));
|
||||||
else
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < dbg_breakp.ga_len; ++i)
|
for (i = 0; i < dbg_breakp.ga_len; ++i)
|
||||||
{
|
{
|
||||||
bp = &BREAKP(i);
|
bp = &BREAKP(i);
|
||||||
|
18
src/diff.c
18
src/diff.c
@@ -1180,11 +1180,8 @@ diff_file(diffio_T *dio)
|
|||||||
#endif
|
#endif
|
||||||
// Use xdiff for generating the diff.
|
// Use xdiff for generating the diff.
|
||||||
if (dio->dio_internal)
|
if (dio->dio_internal)
|
||||||
{
|
|
||||||
return diff_file_internal(dio);
|
return diff_file_internal(dio);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
|
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
|
||||||
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
|
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
|
||||||
cmd = alloc(len);
|
cmd = alloc(len);
|
||||||
@@ -1218,7 +1215,6 @@ diff_file(diffio_T *dio)
|
|||||||
vim_free(cmd);
|
vim_free(cmd);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new version of a file from the current buffer and a diff file.
|
* Create a new version of a file from the current buffer and a diff file.
|
||||||
@@ -1432,15 +1428,17 @@ ex_diffsplit(exarg_T *eap)
|
|||||||
// don't use a new tab page, each tab page has its own diffs
|
// don't use a new tab page, each tab page has its own diffs
|
||||||
cmdmod.cmod_tab = 0;
|
cmdmod.cmod_tab = 0;
|
||||||
|
|
||||||
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
|
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) == FAIL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Pretend it was a ":split fname" command
|
// Pretend it was a ":split fname" command
|
||||||
eap->cmdidx = CMD_split;
|
eap->cmdidx = CMD_split;
|
||||||
curwin->w_p_diff = TRUE;
|
curwin->w_p_diff = TRUE;
|
||||||
do_exedit(eap, old_curwin);
|
do_exedit(eap, old_curwin);
|
||||||
|
|
||||||
if (curwin != old_curwin) // split must have worked
|
if (curwin == old_curwin) // split didn't work
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Set 'diff', 'scrollbind' on and 'wrap' off.
|
// Set 'diff', 'scrollbind' on and 'wrap' off.
|
||||||
diff_win_options(curwin, TRUE);
|
diff_win_options(curwin, TRUE);
|
||||||
if (win_valid(old_curwin))
|
if (win_valid(old_curwin))
|
||||||
@@ -1456,8 +1454,6 @@ ex_diffsplit(exarg_T *eap)
|
|||||||
// relative position.
|
// relative position.
|
||||||
scroll_to_fraction(curwin, curwin->w_height);
|
scroll_to_fraction(curwin, curwin->w_height);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set options to show diffs for the current window.
|
* Set options to show diffs for the current window.
|
||||||
|
@@ -1681,15 +1681,15 @@ registerdigraph(int char1, int char2, int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a new digraph to the table.
|
// Add a new digraph to the table.
|
||||||
if (ga_grow(&user_digraphs, 1) == OK)
|
if (ga_grow(&user_digraphs, 1) != OK)
|
||||||
{
|
return;
|
||||||
|
|
||||||
dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
|
dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
|
||||||
dp->char1 = char1;
|
dp->char1 = char1;
|
||||||
dp->char2 = char2;
|
dp->char2 = char2;
|
||||||
dp->result = n;
|
dp->result = n;
|
||||||
++user_digraphs.ga_len;
|
++user_digraphs.ga_len;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the characters are valid for a digraph.
|
* Check the characters are valid for a digraph.
|
||||||
@@ -1948,8 +1948,9 @@ printdigraph(digr_T *dp, result_T *previous)
|
|||||||
else
|
else
|
||||||
list_width = 11;
|
list_width = 11;
|
||||||
|
|
||||||
if (dp->result != 0)
|
if (dp->result == 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
#if defined(USE_UNICODE_DIGRAPHS)
|
#if defined(USE_UNICODE_DIGRAPHS)
|
||||||
if (previous != NULL)
|
if (previous != NULL)
|
||||||
{
|
{
|
||||||
@@ -1996,7 +1997,6 @@ printdigraph(digr_T *dp, result_T *previous)
|
|||||||
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
|
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
|
||||||
msg_outtrans(buf);
|
msg_outtrans(buf);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
/*
|
/*
|
||||||
|
@@ -225,8 +225,9 @@ handle_foldcolumn(win_T *wp, winlinevars_T *wlv)
|
|||||||
// Allocate a buffer, "wlv->extra[]" may already be in use.
|
// Allocate a buffer, "wlv->extra[]" may already be in use.
|
||||||
vim_free(wlv->p_extra_free);
|
vim_free(wlv->p_extra_free);
|
||||||
wlv->p_extra_free = alloc(MAX_MCO * fdc + 1);
|
wlv->p_extra_free = alloc(MAX_MCO * fdc + 1);
|
||||||
if (wlv->p_extra_free != NULL)
|
if (wlv->p_extra_free == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
wlv->n_extra = (int)fill_foldcolumn(wlv->p_extra_free,
|
wlv->n_extra = (int)fill_foldcolumn(wlv->p_extra_free,
|
||||||
wp, FALSE, wlv->lnum);
|
wp, FALSE, wlv->lnum);
|
||||||
wlv->p_extra_free[wlv->n_extra] = NUL;
|
wlv->p_extra_free[wlv->n_extra] = NUL;
|
||||||
@@ -238,7 +239,6 @@ handle_foldcolumn(win_T *wp, winlinevars_T *wlv)
|
|||||||
else
|
else
|
||||||
wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_FC));
|
wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_FC));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_SIGNS
|
#ifdef FEAT_SIGNS
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
1098,
|
||||||
/**/
|
/**/
|
||||||
1097,
|
1097,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user