diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-05-15 15:04:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 21:04:56 +0800 |
commit | 793496aecc23fdee93040fc94ca3e1a66da73039 (patch) | |
tree | 2a7de4d94f7c04e0340b595ad059c0e5e49472c1 /src/nvim/eval/funcs.c | |
parent | 4c7462fdb313a64d6903809ece2d8d564c0ea420 (diff) | |
download | rneovim-793496aecc23fdee93040fc94ca3e1a66da73039.tar.gz rneovim-793496aecc23fdee93040fc94ca3e1a66da73039.tar.bz2 rneovim-793496aecc23fdee93040fc94ca3e1a66da73039.zip |
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.
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index ee00736b63..04e9ffa570 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -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++) { |