mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
refactor: follow style guide
- reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
This commit is contained in:
@@ -519,14 +519,12 @@ static int del_history_idx(int histype, int idx)
|
||||
/// "histadd()" function
|
||||
void f_histadd(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
{
|
||||
HistoryType histype;
|
||||
|
||||
rettv->vval.v_number = false;
|
||||
if (check_secure()) {
|
||||
return;
|
||||
}
|
||||
const char *str = tv_get_string_chk(&argvars[0]); // NULL on type error
|
||||
histype = str != NULL ? get_histtype(str, strlen(str), false) : HIST_INVALID;
|
||||
HistoryType histype = str != NULL ? get_histtype(str, strlen(str), false) : HIST_INVALID;
|
||||
if (histype == HIST_INVALID) {
|
||||
return;
|
||||
}
|
||||
@@ -605,7 +603,6 @@ void ex_history(exarg_T *eap)
|
||||
int histype2 = HIST_CMD;
|
||||
int hisidx1 = 1;
|
||||
int hisidx2 = -1;
|
||||
int i;
|
||||
char *end;
|
||||
char *arg = eap->arg;
|
||||
|
||||
@@ -661,7 +658,7 @@ void ex_history(exarg_T *eap)
|
||||
k = (-k > hislen) ? 0 : hist[(hislen + k + idx + 1) % hislen].hisnum;
|
||||
}
|
||||
if (idx >= 0 && j <= k) {
|
||||
for (i = idx + 1; !got_int; i++) {
|
||||
for (int i = idx + 1; !got_int; i++) {
|
||||
if (i == hislen) {
|
||||
i = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user