[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 30966a6e67 04/11: Simplify CHAR_TABLE_REF_ASCII
From: |
Paul Eggert |
Subject: |
master 30966a6e67 04/11: Simplify CHAR_TABLE_REF_ASCII |
Date: |
Tue, 31 May 2022 04:26:59 -0400 (EDT) |
branch: master
commit 30966a6e67ff5b599a2906b9e336ab5744786f06
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>
Simplify CHAR_TABLE_REF_ASCII
* src/lisp.h (CHAR_TABLE_REF_ASCII): Refactor as a straightforward
for-loop. Redo an if-then-else to be an (!if)-else-then as this
is a bit cleaner, and it also works around GCC bug 105755.
---
src/lisp.h | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/lisp.h b/src/lisp.h
index 3578ca57b4..ff6f0aaf54 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2091,19 +2091,17 @@ XSUB_CHAR_TABLE (Lisp_Object a)
INLINE Lisp_Object
CHAR_TABLE_REF_ASCII (Lisp_Object ct, ptrdiff_t idx)
{
- struct Lisp_Char_Table *tbl = NULL;
- Lisp_Object val;
- do
+ for (struct Lisp_Char_Table *tbl = XCHAR_TABLE (ct); ;
+ tbl = XCHAR_TABLE (tbl->parent))
{
- tbl = tbl ? XCHAR_TABLE (tbl->parent) : XCHAR_TABLE (ct);
- val = (! SUB_CHAR_TABLE_P (tbl->ascii) ? tbl->ascii
- : XSUB_CHAR_TABLE (tbl->ascii)->contents[idx]);
+ Lisp_Object val = (SUB_CHAR_TABLE_P (tbl->ascii)
+ ? XSUB_CHAR_TABLE (tbl->ascii)->contents[idx]
+ : tbl->ascii);
if (NILP (val))
val = tbl->defalt;
+ if (!NILP (val) || NILP (tbl->parent))
+ return val;
}
- while (NILP (val) && ! NILP (tbl->parent));
-
- return val;
}
/* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
- master updated (d94890404e -> a55a0483c9), Paul Eggert, 2022/05/31
- master 1f6973241a 07/11: Pacify GCC 12 in Fx_show_tip, Paul Eggert, 2022/05/31
- master a1c19dfca4 01/11: Pacify GCC 12 -Wanalyzer-use-of-uninitialized-value, Paul Eggert, 2022/05/31
- master c4da5db04b 08/11: Pacify GCC 12 in Fmove_overlay, Paul Eggert, 2022/05/31
- master 82c05c034e 03/11: Avoid undefined behavior in detect_coding routines, Paul Eggert, 2022/05/31
- master 877be9098e 02/11: Pacify GCC 12 -fanalyzer in x_popup_menu_1, Paul Eggert, 2022/05/31
- master 0614e0f3e9 10/11: Pacify GCC 12 in dump_queue_enqueue, Paul Eggert, 2022/05/31
- master 13dac6f3e9 05/11: Pacify GCC 12 false positive in ccl.c, Paul Eggert, 2022/05/31
- master 569d4c7ad6 09/11: Be more robust if doc file is corrupted, Paul Eggert, 2022/05/31
- master a55a0483c9 11/11: Pacify GCC 12 in x_get_current_wm_state, Paul Eggert, 2022/05/31
- master 30966a6e67 04/11: Simplify CHAR_TABLE_REF_ASCII,
Paul Eggert <=
- master 920f1e68b8 06/11: Pacify GCC 12 in xrdb.c, Paul Eggert, 2022/05/31