summaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-10-29 11:57:06 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2024-01-13 20:50:38 +0100
commita3ae5653cfe1ab2b3eb4c77ce729844ad442b562 (patch)
tree660892925e71fc631389825b8bf729b5c604f730 /src/json.c
parentfa5c07fc87d557e642fc325852e8d0c87a9c176e (diff)
downloademacs-a3ae5653cfe1ab2b3eb4c77ce729844ad442b562.tar.gz
Store hash values as integers instead of Lisp_Object
This improves typing, saves pointless tagging and untagging, and prepares for further changes. The new typedef hash_hash_t is an alias for EMACS_UINT, and hash values are still limited to the fixnum range. We now use hash_unused instead of Qnil to mark unused entries. * src/lisp.h (hash_hash_t): New typedef for EMACS_UINT. (hash_unused): New constant. (struct hash_table_test): `hashfn` now returns hash_hash_t. All callers and implementations changed. (struct Lisp_Hash_Table): Retype hash vector to an array of hash_hash_t. All code using it changed accordingly. (HASH_HASH, hash_from_key): * src/fns.c (set_hash_index_slot, hash_index_index) (hash_lookup_with_hash, hash_lookup_get_hash, hash_put): (hash_lookup, hash_put): Retype hash value arguments and return values. All callers adapted.
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c
index d98b312ecc9..1bea4baa8ba 100644
--- a/src/json.c
+++ b/src/json.c
@@ -879,7 +879,8 @@ json_to_lisp (json_t *json, const struct json_configuration *conf)
json_t *value;
json_object_foreach (json, key_str, value)
{
- Lisp_Object key = build_string_from_utf8 (key_str), hash;
+ Lisp_Object key = build_string_from_utf8 (key_str);
+ hash_hash_t hash;
ptrdiff_t i = hash_lookup (h, key, &hash);
/* Keys in JSON objects are unique, so the key can't
be present yet. */