]> git.eshelyaron.com Git - emacs.git/commitdiff
Replace XSET_HASH_TABLE with make_lisp_hash_table
authorMattias EngdegÄrd <mattiase@acm.org>
Mon, 19 Feb 2024 10:44:53 +0000 (11:44 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 28 Feb 2024 17:36:28 +0000 (18:36 +0100)
* src/lisp.h (XSET_HASH_TABLE): Remove, replace with...
(make_lisp_hash_table): ...this.  All callers adapted.

(cherry picked from commit 188fe6bffa69e08b60a7d65709998bd803b7ada5)

src/alloc.c
src/fns.c
src/lisp.h

index 6abe9e28650fd70dd4d20e01e7dd1401443f13ee..8c94c7eb33cc1d022c6136d6242c4265914a5145 100644 (file)
@@ -6034,8 +6034,7 @@ purecopy (Lisp_Object obj)
           return obj; /* Don't hash cons it.  */
         }
 
-      struct Lisp_Hash_Table *h = purecopy_hash_table (table);
-      XSET_HASH_TABLE (obj, h);
+      obj = make_lisp_hash_table (purecopy_hash_table (table));
     }
   else if (COMPILEDP (obj) || VECTORP (obj) || RECORDP (obj))
     {
index f94e851995735dd9da03ea31f57ac6c6f86ecbb2..0a9692f36e82da3e3e5ed84372b87911b2f28ff1 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -4608,13 +4608,7 @@ make_hash_table (const struct hash_table_test *test, EMACS_INT size,
   h->next_weak = NULL;
   h->purecopy = purecopy;
   h->mutable = true;
-
-  Lisp_Object table;
-  XSET_HASH_TABLE (table, h);
-  eassert (HASH_TABLE_P (table));
-  eassert (XHASH_TABLE (table) == h);
-
-  return table;
+  return make_lisp_hash_table (h);
 }
 
 
@@ -4624,7 +4618,6 @@ make_hash_table (const struct hash_table_test *test, EMACS_INT size,
 static Lisp_Object
 copy_hash_table (struct Lisp_Hash_Table *h1)
 {
-  Lisp_Object table;
   struct Lisp_Hash_Table *h2;
 
   h2 = allocate_hash_table ();
@@ -4649,9 +4642,7 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
       h2->index = hash_table_alloc_bytes (index_bytes);
       memcpy (h2->index, h1->index, index_bytes);
     }
-  XSET_HASH_TABLE (table, h2);
-
-  return table;
+  return make_lisp_hash_table (h2);
 }
 
 
index 79a6a054b819e8d21da8ec3a1d7765bcba37bb41..db053ba9f70ea7af149d8b473d519007d0474971 100644 (file)
@@ -2547,8 +2547,12 @@ XHASH_TABLE (Lisp_Object a)
   return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Hash_Table);
 }
 
-#define XSET_HASH_TABLE(VAR, PTR) \
-  XSETPSEUDOVECTOR (VAR, PTR, PVEC_HASH_TABLE)
+INLINE Lisp_Object
+make_lisp_hash_table (struct Lisp_Hash_Table *h)
+{
+  eassert (PSEUDOVECTOR_TYPEP (&h->header, PVEC_HASH_TABLE));
+  return make_lisp_ptr (h, Lisp_Vectorlike);
+}
 
 /* Value is the key part of entry IDX in hash table H.  */
 INLINE Lisp_Object