fix PVS warnings (#18459)

* fix(PVS/V547): remove ifs that are always true or false

* fix(PVS/V560): remove partial conditions that are always true

* fix(PVS/V1044): suppress warning about loop break conditions

* fix(PVS/V1063): suppress "modulo by 1 operation is meaningless"

* fix(PVS/V568): suppress "operator evaluates the size of a pointer"

Also mark vim-patch:8.2.4958 as ported.
This commit is contained in:
dundargoc
2022-05-15 15:04:56 +02:00
committed by GitHub
parent 4c7462fdb3
commit 793496aecc
10 changed files with 31 additions and 38 deletions

View File

@@ -9711,26 +9711,24 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (*curwin->w_s->b_p_spl != NUL) {
const char *const str = tv_get_string(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN) {
maxcount = tv_get_number_chk(&argvars[1], &typeerr);
if (maxcount <= 0) {
const char *const str = tv_get_string(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN) {
maxcount = tv_get_number_chk(&argvars[1], &typeerr);
if (maxcount <= 0) {
goto f_spellsuggest_return;
}
if (argvars[2].v_type != VAR_UNKNOWN) {
need_capital = tv_get_number_chk(&argvars[2], &typeerr);
if (typeerr) {
goto f_spellsuggest_return;
}
if (argvars[2].v_type != VAR_UNKNOWN) {
need_capital = tv_get_number_chk(&argvars[2], &typeerr);
if (typeerr) {
goto f_spellsuggest_return;
}
}
} else {
maxcount = 25;
}
spell_suggest_list(&ga, (char_u *)str, maxcount, need_capital, false);
} else {
maxcount = 25;
}
spell_suggest_list(&ga, (char_u *)str, maxcount, need_capital, false);
f_spellsuggest_return:
tv_list_alloc_ret(rettv, (ptrdiff_t)ga.ga_len);
for (int i = 0; i < ga.ga_len; i++) {