From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chris Gregory Newsgroups: gmane.emacs.devel Subject: (unknown) Date: Wed, 28 Dec 2016 01:15:01 -0600 Message-ID: <878tr0le2y.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1482909348 28148 195.159.176.226 (28 Dec 2016 07:15:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Dec 2016 07:15:48 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 28 08:15:44 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cM8Sb-00065y-54 for ged-emacs-devel@m.gmane.org; Wed, 28 Dec 2016 08:15:41 +0100 Original-Received: from localhost ([::1]:58027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cM8Sc-0007mI-V3 for ged-emacs-devel@m.gmane.org; Wed, 28 Dec 2016 02:15:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cM8S1-0007km-Kr for emacs-devel@gnu.org; Wed, 28 Dec 2016 02:15:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cM8S0-0002SE-FP for emacs-devel@gnu.org; Wed, 28 Dec 2016 02:15:05 -0500 Original-Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]:36318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cM8S0-0002SA-9r for emacs-devel@gnu.org; Wed, 28 Dec 2016 02:15:04 -0500 Original-Received: by mail-io0-x241.google.com with SMTP id m204so10155551ioe.3 for ; Tue, 27 Dec 2016 23:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:to:to:date:message-id:mime-version; bh=p5H8+F05EtuP5h0CKOFGnEAGZjvcgD2K8V4MZF0ebA0=; b=Q2M1fXSdaAKEzVg37m5m/CecPV1/KmTkA43z5LdmHLKusLitymdDA0AhKf2ipaLh38 A9LwnM/NVjCkBQ1B7hnNxmx1C2IMYE6i0enMnXGE08NASMAozqFb5BSm9fmDbqxIj4nr ppXe4P/1/0Oz5c18/r8136rWjfkbMnx4hzT8D+CmsXe0fZnyzr1TX9cXv7PIOpvYHvYK DCMH6tntf4fb17u849eBbLdOGqv/UQ+x4pe8O66cMVNfaw14LOCsE4xccpehwWs/r6qf MDFdm/ucESbgIjGmCYgob56S7T6ALZQjhfh0S/LkGL7XiFNHeO592DPaTKDH5J74uTdA aoQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:to:to:date:message-id:mime-version; bh=p5H8+F05EtuP5h0CKOFGnEAGZjvcgD2K8V4MZF0ebA0=; b=fUPpw84baRBhHvi+RRCYIvQCYser7Qayj35gf72Iy6M8Gp2vyAgyFDEGzH1bXx/tEN 28DDnh2U9Nw1fyAzg2SatOrOELca/fIMm65+eaTOBYJjiqfxGb7jrC8Q30a8OMxayGDZ C9xdttJFnPJpeuwVw8blkh1uuRVph+I2wgfCTXSR+XFuX80VtZb0hTSvkJyOh7tlUFgK 5toYtxEm6ucB+IrDBBAdhCFax3mtLu2K7Ub2OV/5ONFxDdegKx/sLgzBqEMVmZuVy/VD MyQZj/oc2C+Goxeth45uU4YnoLIo2guzZi9tGSFKNkACE3QtVjAU/HLpd8o+wjgFRnSg C0xg== X-Gm-Message-State: AIkVDXJF5//9DAR7eiFTDRh2EaPYxSQ+V99MPA8vJLbEZxJFrS9ocXctt8GxYGc8QosjNg== X-Received: by 10.107.59.88 with SMTP id i85mr28591252ioa.198.1482909303412; Tue, 27 Dec 2016 23:15:03 -0800 (PST) Original-Received: from CzipperZag ([2604:2d80:8039:81de:a0b5:3d06:3bb2:d546]) by smtp.gmail.com with ESMTPSA id j96sm23191879ioo.29.2016.12.27.23.15.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 23:15:02 -0800 (PST) Original-To: emacs-devel@gnu.org Original-To: czipperz@gmail.com Original-To: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210871 Archived-At: Here is another patch that does more of this. -- Chris Gregory diff --git a/src/eval.c b/src/eval.c index e50e26a..9e1d612 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1313,20 +1313,12 @@ internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers, Lisp_Object (*hfun) (Lisp_Object)) { struct handler *c = push_handler (handlers, CONDITION_CASE); - if (sys_setjmp (c->jmp)) - { - Lisp_Object val = handlerlist->val; - clobbered_eassert (handlerlist == c); - handlerlist = handlerlist->next; - return hfun (val); - } - else - { - Lisp_Object val = bfun (); - clobbered_eassert (handlerlist == c); - handlerlist = handlerlist->next; - return val; - } + bool is_returning = sys_setjmp (c->jmp); + Lisp_Object val = is_returning ? handlerlist->val : bfun (); + + clobbered_eassert (handlerlist == c); + handlerlist = handlerlist->next; + return is_returning ? hfun (val) : val; } /* Like internal_condition_case but call BFUN with ARG as its argument. */ @@ -1364,20 +1356,12 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), Lisp_Object (*hfun) (Lisp_Object)) { struct handler *c = push_handler (handlers, CONDITION_CASE); - if (sys_setjmp (c->jmp)) - { - Lisp_Object val = handlerlist->val; - clobbered_eassert (handlerlist == c); - handlerlist = handlerlist->next; - return hfun (val); - } - else - { - Lisp_Object val = bfun (arg1, arg2); - clobbered_eassert (handlerlist == c); - handlerlist = handlerlist->next; - return val; - } + bool is_returning = sys_setjmp (c->jmp); + Lisp_Object val = is_returning ? handlerlist->val : bfun (arg1, arg2); + + clobbered_eassert (handlerlist == c); + handlerlist = handlerlist->next; + return is_returning ? hfun (val) : val; } /* Like internal_condition_case but call BFUN with NARGS as first, @@ -1393,20 +1377,12 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), Lisp_Object *args)) { struct handler *c = push_handler (handlers, CONDITION_CASE); - if (sys_setjmp (c->jmp)) - { - Lisp_Object val = handlerlist->val; - clobbered_eassert (handlerlist == c); - handlerlist = handlerlist->next; - return hfun (val, nargs, args); - } - else - { - Lisp_Object val = bfun (nargs, args); - clobbered_eassert (handlerlist == c); - handlerlist = handlerlist->next; - return val; - } + bool is_returning = sys_setjmp (c->jmp); + Lisp_Object val = is_returning ? handlerlist->val : bfun (nargs, args); + + clobbered_eassert (handlerlist == c); + handlerlist = handlerlist->next; + return is_returning ? hfun (val, nargs, args) : val; } struct handler *