all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chris Gregory <czipperz@gmail.com>
Subject: Re: Simplify internal_catch()
Date: Wed, 28 Dec 2016 00:33:47 -0600	[thread overview]
Message-ID: <87bmvwlfzo.fsf@gmail.com> (raw)

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	other threads:[~2016-12-28  6:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28  6:33 Chris Gregory [this message]
2016-12-28  8:48 ` Simplify internal_catch() Andreas Schwab
2016-12-28 16:45 ` Stefan Monnier
2016-12-28 19:24   ` Paul Eggert
2016-12-28 19:28     ` Stefan Monnier
2016-12-31 21:29       ` Paul Eggert
  -- strict thread matches above, loose matches on Subject: below --
2016-12-28  7:34 [no subject] Chris Gregory
2016-12-28  7:42 ` Simplify internal_catch () Paul Eggert
2016-12-28  1:54 Simplify internal_catch() Chris Gregory
2016-12-28  2:50 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmvwlfzo.fsf@gmail.com \
    --to=czipperz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.