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,44 +460,46 @@ 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
|
||||
{
|
||||
i = last = idx;
|
||||
do
|
||||
hisptr = &history[histype][i];
|
||||
if (hisptr->hisstr == NULL)
|
||||
break;
|
||||
if (vim_regexec(®match, hisptr->hisstr, (colnr_T)0))
|
||||
{
|
||||
hisptr = &history[histype][i];
|
||||
if (hisptr->hisstr == NULL)
|
||||
break;
|
||||
if (vim_regexec(®match, hisptr->hisstr, (colnr_T)0))
|
||||
found = TRUE;
|
||||
vim_free(hisptr->hisstr);
|
||||
clear_hist_entry(hisptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i != last)
|
||||
{
|
||||
found = TRUE;
|
||||
vim_free(hisptr->hisstr);
|
||||
history[histype][last] = *hisptr;
|
||||
clear_hist_entry(hisptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i != last)
|
||||
{
|
||||
history[histype][last] = *hisptr;
|
||||
clear_hist_entry(hisptr);
|
||||
}
|
||||
if (--last < 0)
|
||||
last += hislen;
|
||||
}
|
||||
if (--i < 0)
|
||||
i += hislen;
|
||||
} while (i != idx);
|
||||
if (history[histype][idx].hisstr == NULL)
|
||||
hisidx[histype] = -1;
|
||||
}
|
||||
if (--last < 0)
|
||||
last += hislen;
|
||||
}
|
||||
if (--i < 0)
|
||||
i += hislen;
|
||||
} while (i != idx);
|
||||
|
||||
if (history[histype][idx].hisstr == NULL)
|
||||
hisidx[histype] = -1;
|
||||
|
||||
vim_regfree(regmatch.regprog);
|
||||
return found;
|
||||
}
|
||||
|
Reference in New Issue
Block a user