1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

Refactor: extract hash and index computations to functions

* src/lisp.h (hash_from_key):
* src/fns.c (hash_index_index): New.
(hash_table_rehash, hash_lookup, hash_remove_from_table):
(maybe_resize_hash_table, hash_put):
* src/composite.c (composition_gstring_put_cache): Use them.
This commit is contained in:
Mattias Engdegård 2023-10-29 12:27:04 +01:00
parent 0bc13945ac
commit 462b3e6ae4
3 changed files with 26 additions and 17 deletions

View file

@ -2524,6 +2524,13 @@ HASH_TABLE_SIZE (const struct Lisp_Hash_Table *h)
return size;
}
/* Compute hash value for KEY in hash table H. */
INLINE Lisp_Object
hash_from_key (struct Lisp_Hash_Table *h, Lisp_Object key)
{
return h->test.hashfn (key, h);
}
void hash_table_rehash (Lisp_Object);
/* Default size for hash tables if not specified. */