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: Simplify more functions by removing local variables Date: Wed, 28 Dec 2016 01:41:23 -0600 Message-ID: <87zijgjyak.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1482910928 7366 195.159.176.226 (28 Dec 2016 07:42:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Dec 2016 07:42:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 28 08:42:02 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 1cM8s3-0000mf-Tc for ged-emacs-devel@m.gmane.org; Wed, 28 Dec 2016 08:42:00 +0100 Original-Received: from localhost ([::1]:58072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cM8s8-0002RI-Aq for ged-emacs-devel@m.gmane.org; Wed, 28 Dec 2016 02:42:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cM8rX-0002Ms-9C for emacs-devel@gnu.org; Wed, 28 Dec 2016 02:41:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cM8rW-0000mx-CT for emacs-devel@gnu.org; Wed, 28 Dec 2016 02:41:27 -0500 Original-Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]:35714) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cM8rW-0000mq-6o for emacs-devel@gnu.org; Wed, 28 Dec 2016 02:41:26 -0500 Original-Received: by mail-it0-x235.google.com with SMTP id c20so201922640itb.0 for ; Tue, 27 Dec 2016 23:41:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=gYJGbtZ5D1NfdrhOZKijH72E2ZbzjgNe+bBqp3jd7zM=; b=l32Js1uVHjaefBa+/a+QwNSW8Voi1FOGSn5/M99atKBXN1jOqNk/GaBbCbsh+JYRko hD1qO0QbbwP0H6V8/Xn8Vx2VGTcYM8qqsG0OUFEFgt6wcxXootox7ktM9JE9ZdpxaPlk n6gIrpQ2fSepB3sxy9huWPsn162DrQBTrKExwtjy1c2uBmC3R2vI26+i6kT05+5JVE+K A9sN3D2/5ofOlept3/BvMpBcp0jlfCCrkf6SUUt6EgLHMOF/RwMCizs+rw+oHIQr08eH 5VBNzT3Zk48XVruYw3/wC+0DJzbOdR6KiXs1bT1rPQnJWnVhtFzvuCYb/HD+T3WOd6Re Xf+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=gYJGbtZ5D1NfdrhOZKijH72E2ZbzjgNe+bBqp3jd7zM=; b=ZvhyKJr3Uz6JDjeACqeKsqd3V4PEugCUEWFrSwt0ZV+xlU5Z7lWdU/wx+tpRgX5lw9 j2woQnLFyjGsjra5dj9Gz/PbKD52CJQSatPiaCO1bkTExEbS9cmX708EIL8uveBimIIT 2LsjTbPvrk03x/5RN09C5Jg2CcE6n1BLw7fogJ5U2O22tq633kX+8gFOjf+GY3nRww5I bTnoFiBFuKAURv3PwcanRXalv6o03UHpScLLScLP8bUP8yH+oDolpb6AoBqzM2xzWXyP DU8P1i27M2ImkT7/sWfhnub/tKGL9PtT7qTgG+VYHZ16y04Hr4g1sWjxuS0NcfKS0xTQ lECw== X-Gm-Message-State: AIkVDXIKT8FiBk9M8FrNJEYSdj08yTtpMYoKMJoUIbUu0cV06ll4Q5rMs+Qez5IkOsJhvA== X-Received: by 10.36.41.138 with SMTP id p132mr31582498itp.61.1482910885278; Tue, 27 Dec 2016 23:41:25 -0800 (PST) Original-Received: from CzipperZag ([2604:2d80:8039:81de:a0b5:3d06:3bb2:d546]) by smtp.gmail.com with ESMTPSA id h17sm21820236ith.17.2016.12.27.23.41.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 23:41:24 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::235 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:210874 Archived-At: Many functions do something like > type var; > var = x; > use (var); and then never use var again. I simplified these to > use(x); while not reordering instructions. The following would be unchanged: > type var; > var = f (); > g (); > h (var); -- Chris Gregory diff --git a/src/eval.c b/src/eval.c index e50e26a..1def5db 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1179,12 +1179,10 @@ If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. usage: (unwind-protect BODYFORM UNWINDFORMS...) */) (Lisp_Object args) { - Lisp_Object val; ptrdiff_t count = SPECPDL_INDEX (); record_unwind_protect (prog_ignore, XCDR (args)); - val = eval_sub (XCAR (args)); - return unbind_to (count, val); + return unbind_to (count, eval_sub (XCAR (args))); } DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0, @@ -1502,7 +1500,6 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) and DATA is (REAL-ERROR-SYMBOL . REAL-DATA). That is a special case--don't do this in other situations. */ Lisp_Object conditions; - Lisp_Object string; Lisp_Object real_error_symbol = (NILP (error_symbol) ? Fcar (data) : error_symbol); register Lisp_Object clause = Qnil; @@ -1570,37 +1567,26 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) || (CONSP (clause) && !NILP (Fmemq (Qdebug, clause))) /* Special handler that means "print a message and run debugger if requested". */ - || EQ (h->tag_or_ch, Qerror))) - { - bool debugger_called - = maybe_call_debugger (conditions, error_symbol, data); + || EQ (h->tag_or_ch, Qerror)) + && maybe_call_debugger (conditions, error_symbol, data) /* We can't return values to code which signaled an error, but we can continue code which has signaled a quit. */ - if (keyboard_quit && debugger_called && EQ (real_error_symbol, Qquit)) - return Qnil; - } + && keyboard_quit + && EQ (real_error_symbol, Qquit)) + return Qnil; if (!NILP (clause)) - { - Lisp_Object unwind_data - = (NILP (error_symbol) ? data : Fcons (error_symbol, data)); - - unwind_to_catch (h, unwind_data); - } - else - { - if (handlerlist != handlerlist_sentinel) - /* FIXME: This will come right back here if there's no `top-level' - catcher. A better solution would be to abort here, and instead - add a catch-all condition handler so we never come here. */ - Fthrow (Qtop_level, Qt); - } + unwind_to_catch (h, NILP (error_symbol) ? data : Fcons (error_symbol, data)); + else if (handlerlist != handlerlist_sentinel) + /* FIXME: This will come right back here if there's no `top-level' + catcher. A better solution would be to abort here, and instead + add a catch-all condition handler so we never come here. */ + Fthrow (Qtop_level, Qt); if (! NILP (error_symbol)) data = Fcons (error_symbol, data); - string = Ferror_message_string (data); - fatal ("%s", SDATA (string)); + fatal ("%s", SDATA (Ferror_message_string (data))); } /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ @@ -1835,9 +1821,7 @@ then strings and vectors are not accepted. */) register Lisp_Object funcar; Lisp_Object if_prop = Qnil; - fun = function; - - fun = indirect_function (fun); /* Check cycles. */ + fun = indirect_function (function); /* Check cycles. */ if (NILP (fun)) return Qnil;