diff options
| author | Mattias EngdegÄrd | 2023-10-30 12:34:26 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-01-12 18:02:14 +0100 |
| commit | 3da324fbd3c7e8e282585ed617efe6ae740acf1a (patch) | |
| tree | be641c145e1ddfd707fdbae04d14f8f0df286e43 /src | |
| parent | 22201dde773e5404f80baa1f59768e88d97a322a (diff) | |
| download | emacs-3da324fbd3c7e8e282585ed617efe6ae740acf1a.tar.gz emacs-3da324fbd3c7e8e282585ed617efe6ae740acf1a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/composite.h | 18 |
1 files 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) | |||
| 84 | ? XCDR (XCDR (XCDR (prop))) \ | 84 | ? XCDR (XCDR (XCDR (prop))) \ |
| 85 | : CONSP (prop) ? XCDR (prop) : Qnil) | 85 | : CONSP (prop) ? XCDR (prop) : Qnil) |
| 86 | 86 | ||
| 87 | #define COMPOSITION_KEY(cmp) \ | ||
| 88 | HASH_KEY (XHASH_TABLE (composition_hash_table), (cmp)->hash_index) | ||
| 89 | |||
| 87 | /* Return the Nth glyph of composition specified by CMP. CMP is a | 90 | /* Return the Nth glyph of composition specified by CMP. CMP is a |
| 88 | pointer to `struct composition'. */ | 91 | pointer to `struct composition'. */ |
| 89 | #define COMPOSITION_GLYPH(cmp, n) \ | 92 | #define COMPOSITION_GLYPH(cmp, n) \ |
| 90 | XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ | 93 | XFIXNUM (AREF (COMPOSITION_KEY (cmp), \ |
| 91 | ->key_and_value) \ | 94 | (cmp)->method == COMPOSITION_WITH_RULE_ALTCHARS \ |
| 92 | ->contents[cmp->hash_index * 2]) \ | 95 | ? (n) * 2 : (n))) |
| 93 | ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \ | ||
| 94 | ? (n) * 2 : (n)]) | ||
| 95 | 96 | ||
| 96 | /* Return the encoded composition rule to compose the Nth glyph of | 97 | /* Return the encoded composition rule to compose the Nth glyph of |
| 97 | rule-base composition specified by CMP. CMP is a pointer to | 98 | rule-base composition specified by CMP. CMP is a pointer to |
| 98 | `struct composition'. */ | 99 | `struct composition'. */ |
| 99 | #define COMPOSITION_RULE(cmp, n) \ | 100 | #define COMPOSITION_RULE(cmp, n) \ |
| 100 | XFIXNUM (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ | 101 | XFIXNUM (AREF (COMPOSITION_KEY (cmp), (n) * 2 - 1)) |
| 101 | ->key_and_value) \ | ||
| 102 | ->contents[cmp->hash_index * 2]) \ | ||
| 103 | ->contents[(n) * 2 - 1]) | ||
| 104 | 102 | ||
| 105 | /* Decode encoded composition rule RULE_CODE into GREF (global | 103 | /* Decode encoded composition rule RULE_CODE into GREF (global |
| 106 | reference point code), NREF (new ref. point code). Don't check RULE_CODE; | 104 | reference point code), NREF (new ref. point code). Don't check RULE_CODE; |