summaryrefslogtreecommitdiffstats
path: root/src/hashtab.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-25 21:32:09 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-25 21:32:09 +0000
commitb3d614369fceb891819badc941f80f08f57831f9 (patch)
treee2986686fe43369523f0c062ea3564467e851590 /src/hashtab.c
parent71d53e7c579b8af44083142ea3894b455947ad81 (diff)
patch 9.0.1097: tests are failingv9.0.1097
Problem: Tests are failing. Solution: Do clean up a hashtab when at the initial size.
Diffstat (limited to 'src/hashtab.c')
-rw-r--r--src/hashtab.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/hashtab.c b/src/hashtab.c
index 0c1aca2c5b..dc4ef8888b 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -405,10 +405,6 @@ hash_may_resize(
return FAIL; // overflow
}
- // bail out if the hashtab is already at the desired size
- if (newsize == ht->ht_mask + 1)
- return OK;
-
if (newsize == HT_INIT_SIZE)
{
// Use the small array inside the hashdict structure.
@@ -425,6 +421,13 @@ hash_may_resize(
oldarray = ht->ht_array;
CLEAR_FIELD(ht->ht_smallarray);
}
+
+ else if (newsize == ht->ht_mask + 1)
+ {
+ // the hashtab is already at the desired size, bail out
+ return OK;
+ }
+
else
{
// Allocate an array.