[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 188fe6bffa6 2/3: Replace XSET_HASH_TABLE with make_lisp_hash_tabl
From: |
Mattias Engdegård |
Subject: |
master 188fe6bffa6 2/3: Replace XSET_HASH_TABLE with make_lisp_hash_table |
Date: |
Mon, 19 Feb 2024 12:14:41 -0500 (EST) |
branch: master
commit 188fe6bffa69e08b60a7d65709998bd803b7ada5
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Replace XSET_HASH_TABLE with make_lisp_hash_table
* src/lisp.h (XSET_HASH_TABLE): Remove, replace with...
(make_lisp_hash_table): ...this. All callers adapted.
---
src/alloc.c | 3 +--
src/fns.c | 13 ++-----------
src/lisp.h | 8 ++++++--
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 6abe9e28650..8c94c7eb33c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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))
{
diff --git a/src/fns.c b/src/fns.c
index f94e8519957..0a9692f36e8 100644
--- 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);
}
diff --git a/src/lisp.h b/src/lisp.h
index 79a6a054b81..db053ba9f70 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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