summaryrefslogtreecommitdiff
path: root/src/spellsuggest.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-02 10:25:45 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-02 10:25:45 +0200
commit4ad739fc053c1666d07ba1cf59be26cb1c3e52d7 (patch)
tree66485dc142df679ab7c8091c2e6f14c7bc9608cb /src/spellsuggest.c
parent6f84b6db10ab86bca85e33f3fc6ee735eec8bbe5 (diff)
downloadvim-git-4ad739fc053c1666d07ba1cf59be26cb1c3e52d7.tar.gz
patch 8.2.1564: a few remaining errors from ubsanv8.2.1564
Problem: A few remaining errors from ubsan. Solution: Avoid the warnings. (Dominique Pellé, closes #6837)
Diffstat (limited to 'src/spellsuggest.c')
-rw-r--r--src/spellsuggest.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index 96e7bb634..e2423cd98 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -3731,9 +3731,6 @@ cleanup_suggestions(
int maxscore,
int keep) // nr of suggestions to keep
{
- suggest_T *stp = &SUG(*gap, 0);
- int i;
-
if (gap->ga_len > 0)
{
// Sort the list.
@@ -3744,6 +3741,9 @@ cleanup_suggestions(
// displayed.
if (gap->ga_len > keep)
{
+ int i;
+ suggest_T *stp = &SUG(*gap, 0);
+
for (i = keep; i < gap->ga_len; ++i)
vim_free(stp[i].st_word);
gap->ga_len = keep;