refactor: fix clang warnings (#19453)

This commit is contained in:
zeertzjq
2022-07-21 17:42:59 +08:00
committed by GitHub
parent c15e9d3746
commit 77b9f1eac5
3 changed files with 9 additions and 4 deletions

View File

@@ -2852,11 +2852,13 @@ int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent)
if (!mark_check(fm)) { if (!mark_check(fm)) {
goto theend; goto theend;
} }
assert(fm != NULL);
eap->line1 = fm->mark.lnum; eap->line1 = fm->mark.lnum;
fm = mark_get_visual(curbuf, '>'); fm = mark_get_visual(curbuf, '>');
if (!mark_check(fm)) { if (!mark_check(fm)) {
goto theend; goto theend;
} }
assert(fm != NULL);
eap->line2 = fm->mark.lnum; eap->line2 = fm->mark.lnum;
eap->addr_count++; eap->addr_count++;
} }
@@ -3285,7 +3287,6 @@ int cmd_exists(const char *const name)
/// "fullcommand" function /// "fullcommand" function
void f_fullcommand(typval_T *argvars, typval_T *rettv, FunPtr fptr) void f_fullcommand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{ {
exarg_T ea;
char *name = argvars[0].vval.v_string; char *name = argvars[0].vval.v_string;
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;
@@ -3299,8 +3300,10 @@ void f_fullcommand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
name = skip_range(name, NULL); name = skip_range(name, NULL);
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name; exarg_T ea = {
ea.cmdidx = (cmdidx_T)0; .cmd = (*name == '2' || *name == '3') ? name + 1 : name,
.cmdidx = (cmdidx_T)0,
};
char *p = find_ex_command(&ea, NULL); char *p = find_ex_command(&ea, NULL);
if (p == NULL || ea.cmdidx == CMD_SIZE) { if (p == NULL || ea.cmdidx == CMD_SIZE) {
return; return;
@@ -4390,6 +4393,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
cmd = NULL; cmd = NULL;
goto error; goto error;
} }
assert(fm != NULL);
lnum = fm->mark.lnum; lnum = fm->mark.lnum;
} }
} }

View File

@@ -2509,6 +2509,7 @@ static int ins_compl_get_exp(pos_T *ini)
} else if (ins_buf != curbuf && !buf_valid(ins_buf)) { } else if (ins_buf != curbuf && !buf_valid(ins_buf)) {
ins_buf = curbuf; // In case the buffer was wiped out. ins_buf = curbuf; // In case the buffer was wiped out.
} }
assert(ins_buf != NULL);
compl_old_match = compl_curr_match; // remember the last current match compl_old_match = compl_curr_match; // remember the last current match
pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos; pos = (compl_direction == FORWARD) ? &last_match_pos : &first_match_pos;

View File

@@ -2028,7 +2028,7 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
int mode; int mode;
bool abbr = false; bool abbr = false;
bool get_dict = false; bool get_dict = false;
mapblock_T *mp; mapblock_T *mp = NULL;
int buffer_local; int buffer_local;
int flags = REPTERM_FROM_PART | REPTERM_DO_LT; int flags = REPTERM_FROM_PART | REPTERM_DO_LT;