From 484e04efa4fcb81968cba8e05835812c62856287 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Tue, 28 Nov 2023 13:54:26 +0100
Subject: [PATCH] ; * src/alloc.c (purecopy_hash_table): Simplify

Copy the entire struct, then take care of fields needing special
treatment.
---
 src/alloc.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index fae76d24189..af9c169a3a0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5891,26 +5891,16 @@ purecopy_hash_table (struct Lisp_Hash_Table *table)
   eassert (table->purecopy);
 
   struct Lisp_Hash_Table *pure = pure_alloc (sizeof *pure, Lisp_Vectorlike);
-  struct hash_table_test pure_test = table->test;
+  *pure = *table;
+  pure->mutable = false;
 
-  /* Purecopy the hash table test.  */
-  pure_test.name = purecopy (table->test.name);
-  pure_test.user_hash_function = purecopy (table->test.user_hash_function);
-  pure_test.user_cmp_function = purecopy (table->test.user_cmp_function);
-
-  pure->header = table->header;
-  pure->weak = purecopy (Qnil);
+  pure->test.name = purecopy (table->test.name);
+  pure->test.user_hash_function = purecopy (table->test.user_hash_function);
+  pure->test.user_cmp_function = purecopy (table->test.user_cmp_function);
   pure->hash = purecopy (table->hash);
   pure->next = purecopy (table->next);
   pure->index = purecopy (table->index);
-  pure->count = table->count;
-  pure->next_free = table->next_free;
-  pure->purecopy = table->purecopy;
-  eassert (!pure->mutable);
-  pure->rehash_threshold = table->rehash_threshold;
-  pure->rehash_size = table->rehash_size;
   pure->key_and_value = purecopy (table->key_and_value);
-  pure->test = pure_test;
 
   return pure;
 }
-- 
2.39.5