forked from aniani/vim
patch 9.0.0872: code is indented more than needed
Problem: Code is indented more than needed. Solution: Return early. (Yegappan Lakshmanan, closes #11538)
This commit is contained in:
parent
3b014befa0
commit
623e94e138
@ -131,8 +131,10 @@ init_history(void)
|
||||
|
||||
// If size of history table changed, reallocate it
|
||||
newlen = (int)p_hi;
|
||||
if (newlen != hislen) // history length changed
|
||||
{
|
||||
if (newlen == hislen) // history length didn't change
|
||||
return;
|
||||
|
||||
// history length changed
|
||||
for (type = 0; type < HIST_COUNT; ++type) // adjust the tables
|
||||
{
|
||||
if (newlen)
|
||||
@ -154,8 +156,10 @@ init_history(void)
|
||||
}
|
||||
else
|
||||
temp = NULL;
|
||||
if (newlen == 0 || temp != NULL)
|
||||
{
|
||||
|
||||
if (newlen != 0 && temp == NULL)
|
||||
continue;
|
||||
|
||||
if (hisidx[type] < 0) // there are no entries yet
|
||||
{
|
||||
for (i = 0; i < newlen; ++i)
|
||||
@ -190,9 +194,7 @@ init_history(void)
|
||||
vim_free(history[type]);
|
||||
history[type] = temp;
|
||||
}
|
||||
}
|
||||
hislen = newlen;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -244,8 +246,9 @@ in_history(
|
||||
i = hislen - 1;
|
||||
} while (i != hisidx[type]);
|
||||
|
||||
if (last_i >= 0)
|
||||
{
|
||||
if (last_i < 0)
|
||||
return FALSE;
|
||||
|
||||
str = history[type][i].hisstr;
|
||||
while (i != hisidx[type])
|
||||
{
|
||||
@ -259,8 +262,6 @@ in_history(
|
||||
history[type][i].hisstr = str;
|
||||
history[type][i].time_set = vim_time();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -328,8 +329,10 @@ add_to_history(
|
||||
}
|
||||
last_maptick = -1;
|
||||
}
|
||||
if (!in_history(histype, new_entry, TRUE, sep, FALSE))
|
||||
{
|
||||
|
||||
if (in_history(histype, new_entry, TRUE, sep, FALSE))
|
||||
return;
|
||||
|
||||
if (++hisidx[histype] == hislen)
|
||||
hisidx[histype] = 0;
|
||||
hisptr = &history[histype][hisidx[histype]];
|
||||
@ -346,7 +349,6 @@ add_to_history(
|
||||
hisptr->time_set = vim_time();
|
||||
if (histype == HIST_SEARCH && in_map)
|
||||
last_maptick = maptick;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||
@ -557,17 +559,16 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
|
||||
str = tv_get_string_chk(&argvars[0]); // NULL on type error
|
||||
histype = str != NULL ? get_histtype(str) : -1;
|
||||
if (histype >= 0)
|
||||
{
|
||||
if (histype < 0)
|
||||
return;
|
||||
|
||||
str = tv_get_string_buf(&argvars[1], buf);
|
||||
if (*str != NUL)
|
||||
{
|
||||
if (*str == NUL)
|
||||
return;
|
||||
|
||||
init_history();
|
||||
add_to_history(histype, str, FALSE, NUL);
|
||||
rettv->vval.v_number = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -670,7 +671,9 @@ remove_key_from_history(void)
|
||||
if (i < 0)
|
||||
return;
|
||||
p = history[HIST_CMD][i].hisstr;
|
||||
if (p != NULL)
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
||||
for ( ; *p; ++p)
|
||||
if (STRNCMP(p, "key", 3) == 0 && !isalpha(p[3]))
|
||||
{
|
||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
872,
|
||||
/**/
|
||||
871,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user