[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4b7985db11c 10/11: ; * src/fns.c (Fmake_hash_table): ensure `test
From: |
Mattias Engdegård |
Subject: |
master 4b7985db11c 10/11: ; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol |
Date: |
Fri, 12 Jan 2024 12:04:50 -0500 (EST) |
branch: master
commit 4b7985db11c0fd3a3346a05f271eff9ad687851b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol
---
src/fns.c | 25 +++++++++++--------------
src/lisp.h | 2 +-
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/fns.c b/src/fns.c
index d8da8992ce9..b1d152a15a9 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5299,10 +5299,6 @@ in an error.
usage: (make-hash-table &rest KEYWORD-ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
- Lisp_Object test, weak;
- bool purecopy;
- struct hash_table_test testdesc;
- ptrdiff_t i;
USE_SAFE_ALLOCA;
/* The vector `used' is used to keep track of arguments that
@@ -5311,20 +5307,21 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
memset (used, 0, nargs * sizeof *used);
/* See if there's a `:test TEST' among the arguments. */
- i = get_key_arg (QCtest, nargs, args, used);
- test = i ? args[i] : Qeql;
- if (EQ (test, Qeq))
+ ptrdiff_t i = get_key_arg (QCtest, nargs, args, used);
+ Lisp_Object test = i ? args[i] : Qeql;
+ if (symbols_with_pos_enabled && SYMBOL_WITH_POS_P (test))
+ test = SYMBOL_WITH_POS_SYM (test);
+ struct hash_table_test testdesc;
+ if (BASE_EQ (test, Qeq))
testdesc = hashtest_eq;
- else if (EQ (test, Qeql))
+ else if (BASE_EQ (test, Qeql))
testdesc = hashtest_eql;
- else if (EQ (test, Qequal))
+ else if (BASE_EQ (test, Qequal))
testdesc = hashtest_equal;
else
{
/* See if it is a user-defined test. */
- Lisp_Object prop;
-
- prop = Fget (test, Qhash_table_test);
+ Lisp_Object prop = Fget (test, Qhash_table_test);
if (!CONSP (prop) || !CONSP (XCDR (prop)))
signal_error ("Invalid hash table test", test);
testdesc.name = test;
@@ -5336,7 +5333,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* See if there's a `:purecopy PURECOPY' argument. */
i = get_key_arg (QCpurecopy, nargs, args, used);
- purecopy = i && !NILP (args[i]);
+ bool purecopy = i && !NILP (args[i]);
/* See if there's a `:size SIZE' argument. */
i = get_key_arg (QCsize, nargs, args, used);
Lisp_Object size_arg = i ? args[i] : Qnil;
@@ -5370,7 +5367,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* Look for `:weakness WEAK'. */
i = get_key_arg (QCweakness, nargs, args, used);
- weak = i ? args[i] : Qnil;
+ Lisp_Object weak = i ? args[i] : Qnil;
if (EQ (weak, Qt))
weak = Qkey_and_value;
if (!NILP (weak)
diff --git a/src/lisp.h b/src/lisp.h
index 549b51d3f7f..0421cb68c10 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2387,7 +2387,7 @@ struct Lisp_Hash_Table;
struct hash_table_test
{
- /* Name of the function used to compare keys. */
+ /* Function used to compare keys; always a bare symbol. */
Lisp_Object name;
/* User-supplied hash function, or nil. */
- master 22201dde773 03/11: Decouple profiler from Lisp hash table internals, (continued)
- master 22201dde773 03/11: Decouple profiler from Lisp hash table internals, Mattias Engdegård, 2024/01/12
- master 228e9000181 01/11: Add internal hash-table debug functions, Mattias Engdegård, 2024/01/12
- master 8acd89e955f 02/11: ; * src/pdumper.c (dump_hash_table): Remove unused argument., Mattias Engdegård, 2024/01/12
- master 3da324fbd3c 04/11: Refactor: less layering violation in composite.h, Mattias Engdegård, 2024/01/12
- master 0bc13945acb 05/11: ; * src/fns.c (collect_interval): Move misplaced function., Mattias Engdegård, 2024/01/12
- master 43127e5ec11 07/11: Refactor hash table vector reallocation, Mattias Engdegård, 2024/01/12
- master 484e04efa4f 08/11: ; * src/alloc.c (purecopy_hash_table): Simplify, Mattias Engdegård, 2024/01/12
- master 8b7a6d7b6de 11/11: ; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art., Mattias Engdegård, 2024/01/12
- master 29e3d1c56f0 09/11: Abstract predicate and constant for unused hash keys, Mattias Engdegård, 2024/01/12
- master 462b3e6ae4e 06/11: Refactor: extract hash and index computations to functions, Mattias Engdegård, 2024/01/12
- master 4b7985db11c 10/11: ; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol,
Mattias Engdegård <=