mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1096: reallocating hashtab when the size didn't change
Problem: Reallocating hashtab when the size didn't change.
Solution: Bail out when the hashtab is already the desired size.
71d53e7c57
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
146c428a53
commit
59012a18e1
@ -334,6 +334,11 @@ 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) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool newarray_is_small = newsize == HT_INIT_SIZE;
|
||||
bool keep_smallarray = newarray_is_small
|
||||
&& ht->ht_array == ht->ht_smallarray;
|
||||
|
Loading…
Reference in New Issue
Block a user