]> git.eshelyaron.com Git - emacs.git/commitdiff
; Circumvent miscompilations on Sun C 5.12 (148917-07)
authorPo Lu <luangruo@yahoo.com>
Sat, 16 Mar 2024 01:50:58 +0000 (09:50 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 18 Mar 2024 15:42:31 +0000 (16:42 +0100)
* src/minibuf.c (Ftry_completion, Fall_completions): Transform
ternary expressions after open-ended if statements into proper
if/else statements.

(cherry picked from commit 6461854f47d0b768e0550b46317045811a8cbe80)

src/minibuf.c

index daa3c3ffa94f1eade6083f934d9c1ec1768f7733..16b32824088b6f53ec1dde2be0b784b88e822ac6 100644 (file)
@@ -1667,11 +1667,12 @@ or from one of the possible completions.  */)
                tem = Fcommandp (elt, Qnil);
              else
                {
-                 tem = (type == hash_table
-                        ? call2 (predicate, elt,
-                                 HASH_VALUE (XHASH_TABLE (collection),
-                                             idx - 1))
-                        : call1 (predicate, elt));
+                 if (type == hash_table)
+                   tem = call2 (predicate, elt,
+                                HASH_VALUE (XHASH_TABLE (collection),
+                                            idx - 1));
+                 else
+                   tem = call1 (predicate, elt);
                }
              if (NILP (tem)) continue;
            }
@@ -1807,9 +1808,12 @@ with a space are ignored unless STRING itself starts with a space.  */)
   Lisp_Object allmatches;
   if (VECTORP (collection))
     collection = check_obarray (collection);
-  int type = HASH_TABLE_P (collection) ? 3
-    : OBARRAYP (collection) ? 2
-    : NILP (collection) || (CONSP (collection) && !FUNCTIONP (collection));
+  int type = (HASH_TABLE_P (collection)
+             ? 3 : (OBARRAYP (collection)
+                    ? 2 : ((NILP (collection)
+                            || (CONSP (collection)
+                                && !FUNCTIONP (collection)))
+                           ? 1 : 0)));
   ptrdiff_t idx = 0;
   Lisp_Object bucket, tem, zero;
 
@@ -1888,10 +1892,12 @@ with a space are ignored unless STRING itself starts with a space.  */)
                tem = Fcommandp (elt, Qnil);
              else
                {
-                 tem = type == 3
-                   ? call2 (predicate, elt,
-                            HASH_VALUE (XHASH_TABLE (collection), idx - 1))
-                   : call1 (predicate, elt);
+                 if (type == 3)
+                   tem = call2 (predicate, elt,
+                                HASH_VALUE (XHASH_TABLE (collection),
+                                            idx - 1));
+                 else
+                   tem = call1 (predicate, elt);
                }
              if (NILP (tem)) continue;
            }