summaryrefslogtreecommitdiff
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-05-31 01:19:32 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2022-05-31 01:26:47 -0700
commit30966a6e67ff5b599a2906b9e336ab5744786f06 (patch)
tree717f05572f606472a2f1026bec3d3cb0518ed6b6 /src/lisp.h
parent82c05c034e1ecec49e4e8916b2cb6163d7a5bb74 (diff)
downloademacs-30966a6e67ff5b599a2906b9e336ab5744786f06.tar.gz
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.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 3578ca57b46..ff6f0aaf54d 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