changeset 31527:aa2ec7a12146 v9.0.1096

patch 9.0.1096: reallocating hashtab when the size didn't change Commit: https://github.com/vim/vim/commit/71d53e7c579b8af44083142ea3894b455947ad81 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 25 20:46:13 2022 +0000 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 25 Dec 2022 22:00:04 +0100
parents 9759807cf1f3
children 066d8bd396bc
files src/hashtab.c src/version.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1096,
+/**/
     1095,
 /**/
     1094,