From 448b47a9531f8e04a608374216c1bbfa212b9da7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 15 Aug 2008 03:18:00 +0000 Subject: [PATCH] fix hash-table reset when the table is shrunk svn: r11268 --- src/mzscheme/src/hash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mzscheme/src/hash.c b/src/mzscheme/src/hash.c index 5a4d74b231..b43bddc093 100644 --- a/src/mzscheme/src/hash.c +++ b/src/mzscheme/src/hash.c @@ -490,19 +490,17 @@ void scheme_reset_hash_table(Scheme_Hash_Table *table, int *history) if ((table->size <= 8) || (table->count * FILL_FACTOR > (table->size >> 1))) { /* Keep same size */ - memset(table->vals, 0, sizeof(Scheme_Object *) * table->size); - memset(table->keys, 0, sizeof(Scheme_Object *) * table->size); } else { /* Shrink by one step */ Scheme_Object **ba; table->size >>= 1; ba = MALLOC_N(Scheme_Object *, table->size); - memcpy(ba, table->vals, sizeof(Scheme_Object *) * table->size); table->vals = ba; ba = MALLOC_N(Scheme_Object *, table->size); - memcpy(ba, table->keys, sizeof(Scheme_Object *) * table->size); table->keys = ba; } + memset(table->vals, 0, sizeof(Scheme_Object *) * table->size); + memset(table->keys, 0, sizeof(Scheme_Object *) * table->size); table->count = 0; table->mcount = 0; }