aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/hashtab.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index fdbfdd7d77..448e78ab07 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -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;