emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simplify internal_catch()


From: Chris Gregory
Subject: Re: Simplify internal_catch()
Date: Wed, 28 Dec 2016 00:33:47 -0600

Here is the updated patch.  I replaced the if statement with a ternary
operator.

> Why place the declaration of `val` between the two?
I'm unsure as to the style desired for Emacs source code.  I've seen
both used in it.  I'll use the declaration initialization in the future
as I also prefer that.
-- 
Chris Gregory

diff --git a/src/eval.c b/src/eval.c
index e50e26a..54c09df 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1084,22 +1084,16 @@ internal_catch (Lisp_Object tag,
 {
   /* This structure is made part of the chain `catchlist'.  */
   struct handler *c = push_handler (tag, CATCHER);
-
-  /* Call FUNC.  */
-  if (! sys_setjmp (c->jmp))
-    {
-      Lisp_Object val = func (arg);
-      clobbered_eassert (handlerlist == c);
-      handlerlist = handlerlist->next;
-      return val;
-    }
-  else
-    { /* Throw works by a longjmp that comes right here.  */
-      Lisp_Object val = handlerlist->val;
-      clobbered_eassert (handlerlist == c);
-      handlerlist = handlerlist->next;
-      return val;
-    }
+  Lisp_Object val = (sys_setjmp (c->jmp)
+                     /* Call FUNC */
+                     ? func (arg)
+                     /* Throw works by a longjmp that comes here,
+                        setting this side */
+                     : handlerlist->val);
+
+  clobbered_eassert (handlerlist == c);
+  handlerlist = handlerlist->next;
+  return val;
 }
 
 /* Unwind the specbind, catch, and handler stacks back to CATCH, and



reply via email to

[Prev in Thread] Current Thread [Next in Thread]