summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-12-28 19:04:43 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2024-01-12 18:03:02 +0100
commit29e3d1c56f07a53d1955c9a71e68f70f3b901728 (patch)
tree8af3a2032f9e99368dd2a4ac14bacc26be23d9ea /src/minibuf.c
parent484e04efa4fcb81968cba8e05835812c62856287 (diff)
downloademacs-29e3d1c56f07a53d1955c9a71e68f70f3b901728.tar.gz
emacs-29e3d1c56f07a53d1955c9a71e68f70f3b901728.tar.bz2
emacs-29e3d1c56f07a53d1955c9a71e68f70f3b901728.zip
Abstract predicate and constant for unused hash keys
Qunbound is used for many things; using a predicate and constant for the specific purpose of unused hash entry keys allows us to locate them and make changes much more easily. * src/lisp.h (HASH_UNUSED_ENTRY_KEY, hash_unused_entry_key_p): New constant and function. * src/comp.c (compile_function, Fcomp__compile_ctxt_to_file): * src/composite.c (composition_gstring_cache_clear_font): * src/emacs-module.c (module_global_reference_p): * src/fns.c (make_hash_table, maybe_resize_hash_table, hash_put) (hash_remove_from_table, hash_clear, sweep_weak_table, Fmaphash): * src/json.c (lisp_to_json_nonscalar_1): * src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): * src/print.c (print, print_object): Use them.
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index f4f9da9c3f9..22bb8fa1d75 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1680,8 +1680,8 @@ or from one of the possible completions. */)
else /* if (type == hash_table) */
{
while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection))
- && BASE_EQ (HASH_KEY (XHASH_TABLE (collection), idx),
- Qunbound))
+ && hash_unused_entry_key_p (HASH_KEY (XHASH_TABLE (collection),
+ idx)))
idx++;
if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection)))
break;
@@ -1918,8 +1918,8 @@ with a space are ignored unless STRING itself starts with a space. */)
else /* if (type == 3) */
{
while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection))
- && BASE_EQ (HASH_KEY (XHASH_TABLE (collection), idx),
- Qunbound))
+ && hash_unused_entry_key_p (HASH_KEY (XHASH_TABLE (collection),
+ idx)))
idx++;
if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection)))
break;
@@ -2117,7 +2117,7 @@ the values STRING, PREDICATE and `lambda'. */)
for (i = 0; i < HASH_TABLE_SIZE (h); ++i)
{
tem = HASH_KEY (h, i);
- if (BASE_EQ (tem, Qunbound)) continue;
+ if (hash_unused_entry_key_p (tem)) continue;
Lisp_Object strkey = (SYMBOLP (tem) ? Fsymbol_name (tem) : tem);
if (!STRINGP (strkey)) continue;
if (BASE_EQ (Fcompare_strings (string, Qnil, Qnil,