[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3da324fbd3c 04/11: Refactor: less layering violation in composite
From: |
Mattias Engdegård |
Subject: |
master 3da324fbd3c 04/11: Refactor: less layering violation in composite.h |
Date: |
Fri, 12 Jan 2024 12:04:45 -0500 (EST) |
branch: master
commit 3da324fbd3c7e8e282585ed617efe6ae740acf1a
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Refactor: less layering violation in composite.h
Avoid using hash table internals directly.
* src/composite.h (COMPOSITION_KEY): New.
(COMPOSITION_GLYPH, COMPOSITION_RULE): Use COMPOSITION_KEY.
---
src/composite.h | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/composite.h b/src/composite.h
index c99888ccec2..4fe49b764e4 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -84,23 +84,21 @@ composition_registered_p (Lisp_Object prop)
? XCDR (XCDR (XCDR (prop))) \
: CONSP (prop) ? XCDR (prop) : Qnil)
+#define COMPOSITION_KEY(cmp) \
+ HASH_KEY (XHASH_TABLE (composition_hash_table), (cmp)->hash_index)
+
/* Return the Nth glyph of composition specified by CMP. CMP is a
pointer to `struct composition'. */
#define COMPOSITION_GLYPH(cmp, n) \
- XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table)
\
- ->key_and_value) \
- ->contents[cmp->hash_index * 2]) \
- ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \
- ? (n) * 2 : (n)])
+ XFIXNUM (AREF (COMPOSITION_KEY (cmp),
\
+ (cmp)->method == COMPOSITION_WITH_RULE_ALTCHARS \
+ ? (n) * 2 : (n)))
/* Return the encoded composition rule to compose the Nth glyph of
rule-base composition specified by CMP. CMP is a pointer to
`struct composition'. */
-#define COMPOSITION_RULE(cmp, n) \
- XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \
- ->key_and_value) \
- ->contents[cmp->hash_index * 2]) \
- ->contents[(n) * 2 - 1])
+#define COMPOSITION_RULE(cmp, n) \
+ XFIXNUM (AREF (COMPOSITION_KEY (cmp), (n) * 2 - 1))
/* Decode encoded composition rule RULE_CODE into GREF (global
reference point code), NREF (new ref. point code). Don't check RULE_CODE;
- master updated (10cfbda8841 -> 8b7a6d7b6de), Mattias Engdegård, 2024/01/12
- 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 <=
- 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, 2024/01/12