diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-12-25 20:46:13 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-25 20:46:13 +0000 |
commit | 71d53e7c579b8af44083142ea3894b455947ad81 (patch) | |
tree | adacbe3f7b44cb880b2836571514ac1378e32fc8 /src/hashtab.c | |
parent | 6ef5471afa69a654888bc285a51a6035405d33a0 (diff) |
patch 9.0.1096: reallocating hashtab when the size didn't changev9.0.1096
Problem: Reallocating hashtab when the size didn't change.
Solution: Bail out when the hashtab is already the desired size.
Diffstat (limited to 'src/hashtab.c')
-rw-r--r-- | src/hashtab.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/hashtab.c b/src/hashtab.c index db76fde35f..0c1aca2c5b 100644 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -405,6 +405,10 @@ 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. |