summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
author=?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>2022-05-15 13:59:11 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-15 13:59:11 +0100
commitdd41037552c1be3548d2ce34bb1c889f14edb553 (patch)
tree92d4352bf89c6918c9c7e5254c438bc183997bfb /src/evalfunc.c
parentb559b302e0ecc6fced03d5201dc30f10cff7af0a (diff)
patch 8.2.4958: a couple conditions are always truev8.2.4958
Problem: A couple conditions are always true. Solution: Remove the conditions. (Goc Dundar, closes #10428)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index f7a04fdc98..2c012d047e 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -9788,43 +9788,40 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv)
}
#ifdef FEAT_SPELL
- if (*curwin->w_s->b_p_spl != NUL)
+ str = tv_get_string(&argvars[0]);
+ if (argvars[1].v_type != VAR_UNKNOWN)
{
- str = tv_get_string(&argvars[0]);
- if (argvars[1].v_type != VAR_UNKNOWN)
+ maxcount = (int)tv_get_number_chk(&argvars[1], &typeerr);
+ if (maxcount <= 0)
+ return;
+ if (argvars[2].v_type != VAR_UNKNOWN)
{
- maxcount = (int)tv_get_number_chk(&argvars[1], &typeerr);
- if (maxcount <= 0)
+ need_capital = (int)tv_get_bool_chk(&argvars[2], &typeerr);
+ if (typeerr)
return;
- if (argvars[2].v_type != VAR_UNKNOWN)
- {
- need_capital = (int)tv_get_bool_chk(&argvars[2], &typeerr);
- if (typeerr)
- return;
- }
}
- else
- maxcount = 25;
+ }
+ else
+ maxcount = 25;
- spell_suggest_list(&ga, str, maxcount, need_capital, FALSE);
+ spell_suggest_list(&ga, str, maxcount, need_capital, FALSE);
- for (i = 0; i < ga.ga_len; ++i)
- {
- str = ((char_u **)ga.ga_data)[i];
+ for (i = 0; i < ga.ga_len; ++i)
+ {
+ str = ((char_u **)ga.ga_data)[i];
- li = listitem_alloc();
- if (li == NULL)
- vim_free(str);
- else
- {
- li->li_tv.v_type = VAR_STRING;
- li->li_tv.v_lock = 0;
- li->li_tv.vval.v_string = str;
- list_append(rettv->vval.v_list, li);
- }
+ li = listitem_alloc();
+ if (li == NULL)
+ vim_free(str);
+ else
+ {
+ li->li_tv.v_type = VAR_STRING;
+ li->li_tv.v_lock = 0;
+ li->li_tv.vval.v_string = str;
+ list_append(rettv->vval.v_list, li);
}
- ga_clear(&ga);
}
+ ga_clear(&ga);
curwin->w_p_spell = wo_spell_save;
#endif
}