vim-patch:9.0.1097: tests are failing

Problem:    Tests are failing.
Solution:   Do clean up a hashtab when at the initial size.

b3d614369f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2022-12-27 18:54:52 +08:00
parent 59012a18e1
commit 9bab4b72ae

View File

@ -334,12 +334,13 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
assert(newsize != 0);
}
// bail out if the hashtab is already at the desired size
if (newsize == ht->ht_mask + 1) {
bool newarray_is_small = newsize == HT_INIT_SIZE;
if (!newarray_is_small && newsize == ht->ht_mask + 1) {
// the hashtab is already at the desired size, bail out
return;
}
bool newarray_is_small = newsize == HT_INIT_SIZE;
bool keep_smallarray = newarray_is_small
&& ht->ht_array == ht->ht_smallarray;