GNU bug report logs - #45562
[PATCH] Fix "comparison always the same" warnings found by lgtm

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Thu, 31 Dec 2020 08:34:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45562 <at> debbugs.gnu.org, stefan <at> marxist.se
Subject: bug#45562: [PATCH] Fix "comparison always the same" warnings found by lgtm
Date: Fri, 01 Jan 2021 14:05:09 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Stefan Kangas <stefan <at> marxist.se>,  45562 <at> debbugs.gnu.org
> Date: Fri, 01 Jan 2021 12:08:46 +0100
> 
> >> --- a/src/alloc.c
> >> +++ b/src/alloc.c
> >> @@ -4001,7 +4001,7 @@ memory_full (size_t nbytes)
> >>  	  {
> >>  	    if (i == 0)
> >>  	      free (spare_memory[i]);
> >> -	    else if (i >= 1 && i <= 4)
> >> +	    else if (i <= 4)
> >>  	      lisp_align_free (spare_memory[i]);
> >>  	    else
> >>  	      lisp_free (spare_memory[i]);
> >
> > This is an optimization better left to the compiler, IMO.
> 
> I think the change made the code slightly clearer, though?  You don't
> have to think about whether there's anything in the range between 0 and
> >= 1.

If you like the modified code better, I won't object.




This bug report was last modified 4 years and 1 day ago.

Previous Next


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