vim-patch:8.2.1564: a few remaining errors from ubsan

Problem:    A few remaining errors from ubsan.
Solution:   Avoid the warnings. (Dominique Pellé, closes vim/vim#6837)
4ad739fc05
This commit is contained in:
Jan Edmund Lazo
2020-09-02 22:22:15 -04:00
parent b9430fe28e
commit 5fcdb63025
2 changed files with 10 additions and 8 deletions

View File

@@ -5765,14 +5765,14 @@ cleanup_suggestions (
)
FUNC_ATTR_NONNULL_ALL
{
suggest_T *stp = &SUG(*gap, 0);
if (gap->ga_len > 0) {
// Sort the list.
qsort(gap->ga_data, (size_t)gap->ga_len, sizeof(suggest_T), sug_compare);
// Truncate the list to the number of suggestions that will be displayed.
if (gap->ga_len > keep) {
suggest_T *const stp = &SUG(*gap, 0);
for (int i = keep; i < gap->ga_len; i++) {
xfree(stp[i].st_word);
}