mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -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 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
|
||||
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;
|
||||
do
|
||||
{
|
||||
@@ -495,9 +496,10 @@ del_history_entry(int histype, char_u *str)
|
||||
if (--i < 0)
|
||||
i += hislen;
|
||||
} while (i != idx);
|
||||
|
||||
if (history[histype][idx].hisstr == NULL)
|
||||
hisidx[histype] = -1;
|
||||
}
|
||||
|
||||
vim_regfree(regmatch.regprog);
|
||||
return found;
|
||||
}
|
||||
|
@@ -682,8 +682,9 @@ ex_breakadd(exarg_T *eap)
|
||||
gap = &prof_ga;
|
||||
#endif
|
||||
|
||||
if (dbg_parsearg(eap->arg, gap) == OK)
|
||||
{
|
||||
if (dbg_parsearg(eap->arg, gap) != OK)
|
||||
return;
|
||||
|
||||
bp = &DEBUGGY(gap, gap->ga_len);
|
||||
bp->dbg_forceit = eap->forceit;
|
||||
|
||||
@@ -719,7 +720,6 @@ ex_breakadd(exarg_T *eap)
|
||||
if (gap == &dbg_breakp)
|
||||
has_expr_breakpoint = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -822,9 +822,11 @@ ex_breakdel(exarg_T *eap)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
vim_free(DEBUGGY(gap, todel).dbg_name);
|
||||
@@ -851,7 +853,6 @@ ex_breakdel(exarg_T *eap)
|
||||
ga_clear(gap);
|
||||
if (gap == &dbg_breakp)
|
||||
update_has_expr_breakpoint();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -864,8 +865,11 @@ ex_breaklist(exarg_T *eap UNUSED)
|
||||
int i;
|
||||
|
||||
if (dbg_breakp.ga_len == 0)
|
||||
{
|
||||
msg(_("No breakpoints defined"));
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < dbg_breakp.ga_len; ++i)
|
||||
{
|
||||
bp = &BREAKP(i);
|
||||
|
18
src/diff.c
18
src/diff.c
@@ -1180,11 +1180,8 @@ diff_file(diffio_T *dio)
|
||||
#endif
|
||||
// Use xdiff for generating the diff.
|
||||
if (dio->dio_internal)
|
||||
{
|
||||
return diff_file_internal(dio);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
|
||||
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
|
||||
cmd = alloc(len);
|
||||
@@ -1217,7 +1214,6 @@ diff_file(diffio_T *dio)
|
||||
unblock_autocmds();
|
||||
vim_free(cmd);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1432,15 +1428,17 @@ ex_diffsplit(exarg_T *eap)
|
||||
// don't use a new tab page, each tab page has its own diffs
|
||||
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
|
||||
eap->cmdidx = CMD_split;
|
||||
curwin->w_p_diff = TRUE;
|
||||
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.
|
||||
diff_win_options(curwin, TRUE);
|
||||
if (win_valid(old_curwin))
|
||||
@@ -1455,8 +1453,6 @@ ex_diffsplit(exarg_T *eap)
|
||||
// Now that lines are folded scroll to show the cursor at the same
|
||||
// relative position.
|
||||
scroll_to_fraction(curwin, curwin->w_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -1681,14 +1681,14 @@ registerdigraph(int char1, int char2, int n)
|
||||
}
|
||||
|
||||
// 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->char1 = char1;
|
||||
dp->char2 = char2;
|
||||
dp->result = n;
|
||||
++user_digraphs.ga_len;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1948,8 +1948,9 @@ printdigraph(digr_T *dp, result_T *previous)
|
||||
else
|
||||
list_width = 11;
|
||||
|
||||
if (dp->result != 0)
|
||||
{
|
||||
if (dp->result == 0)
|
||||
return;
|
||||
|
||||
#if defined(USE_UNICODE_DIGRAPHS)
|
||||
if (previous != NULL)
|
||||
{
|
||||
@@ -1995,7 +1996,6 @@ printdigraph(digr_T *dp, result_T *previous)
|
||||
*p++ = ' ';
|
||||
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
|
||||
msg_outtrans(buf);
|
||||
}
|
||||
}
|
||||
|
||||
# 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.
|
||||
vim_free(wlv->p_extra_free);
|
||||
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,
|
||||
wp, FALSE, wlv->lnum);
|
||||
wlv->p_extra_free[wlv->n_extra] = NUL;
|
||||
@@ -237,7 +238,6 @@ handle_foldcolumn(win_T *wp, winlinevars_T *wlv)
|
||||
wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_CLF));
|
||||
else
|
||||
wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_FC));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1098,
|
||||
/**/
|
||||
1097,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user