GNU bug report logs - #25338
[PATCH] Remove local variable with only one usage

Previous Next

Package: emacs;

Reported by: Chris Gregory <czipperz <at> gmail.com>

Date: Mon, 2 Jan 2017 21:51:01 UTC

Severity: wishlist

Tags: notabug, patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25338 in the body.
You can then email your comments to 25338 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25338; Package emacs. (Mon, 02 Jan 2017 21:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Gregory <czipperz <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 02 Jan 2017 21:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chris Gregory <czipperz <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Remove local variable with only one usage
Date: Mon, 02 Jan 2017 13:50:01 -0800
-- 
Chris Gregory

diff --git a/src/term.c b/src/term.c
index c067a86d18..0e8ad60de4 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3426,10 +3426,7 @@ tty_menu_last_menubar_item (struct frame *f)
 
       while (i < ASIZE (items))
 	{
-	  Lisp_Object str;
-
-	  str = AREF (items, i + 1);
-	  if (NILP (str))
+	  if (NILP (AREF (items, i + 1)))
 	    break;
 	  i += 4;
 	}




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25338; Package emacs. (Sat, 07 Jan 2017 08:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 25338 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chris Gregory <czipperz <at> gmail.com>
Cc: 25338 <at> debbugs.gnu.org
Subject: Re: bug#25338: [PATCH] Remove local variable with only one usage
Date: Sat, 07 Jan 2017 10:26:30 +0200
tags 25338 notabug
close 25338
thanks

> From: Chris Gregory <czipperz <at> gmail.com>
> Date: Mon, 02 Jan 2017 13:50:01 -0800

Thanks.

IMO, we are splitting hair here.  In an optimized build, a compiler
will optimize 'str' and keep the value in a register, so the variable
doesn't matter.  In a non-optimized build, the existence of the
variable allows to look at it in a debugger.  And the loop is small
enough so that an extra variable local to the loop doesn't make it
more complicated.

So I'd rather not make this change.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 07 Jan 2017 08:27:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25338 <at> debbugs.gnu.org and Chris Gregory <czipperz <at> gmail.com> Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 07 Jan 2017 08:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 04 Feb 2017 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.