]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify CHAR_TABLE_REF_ASCII
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 May 2022 08:19:32 +0000 (01:19 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 May 2022 08:26:47 +0000 (01:26 -0700)
* 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

index 3578ca57b468ccf8239bdc88504ad9b94b594441..ff6f0aaf54d9b14a6c5b83be78d6fb3f09510aa7 100644 (file)
@@ -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