From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#45562: [PATCH] Fix "comparison always the same" warnings found by lgtm Date: Fri, 1 Jan 2021 10:10:38 -0600 Message-ID: References: <83zh1ugj30.fsf@gnu.org> <87h7o0c3sx.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25902"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45562@debbugs.gnu.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 01 17:11:55 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kvN1v-0006dX-2n for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Jan 2021 17:11:55 +0100 Original-Received: from localhost ([::1]:51282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvN1t-0001J3-JW for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Jan 2021 11:11:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvN15-0001C3-18 for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2021 11:11:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kvN14-0005Bb-QM for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2021 11:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kvN14-0006RS-Lh for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2021 11:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Jan 2021 16:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45562 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45562-submit@debbugs.gnu.org id=B45562.160951744624715 (code B ref 45562); Fri, 01 Jan 2021 16:11:02 +0000 Original-Received: (at 45562) by debbugs.gnu.org; 1 Jan 2021 16:10:46 +0000 Original-Received: from localhost ([127.0.0.1]:34581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvN0o-0006QX-2L for submit@debbugs.gnu.org; Fri, 01 Jan 2021 11:10:46 -0500 Original-Received: from mail-pl1-f176.google.com ([209.85.214.176]:32868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvN0m-0006QB-9c for 45562@debbugs.gnu.org; Fri, 01 Jan 2021 11:10:44 -0500 Original-Received: by mail-pl1-f176.google.com with SMTP id b8so11243231plx.0 for <45562@debbugs.gnu.org>; Fri, 01 Jan 2021 08:10:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc:content-transfer-encoding; bh=pGeq6hoKrtRI9pZ+OPHWxFtiQAUtdlGgBzS/GFuqz5g=; b=fs20eycwC4daerXbfDkhrI8jgu4nP3SLYvW2D8i0XqVhKOAdT+zTEyRTAqcZYAFgyA 7ft9zMc/bnwHWYpALffrEJxv4eor7CcgwLAbrVG1QkA6xBco3lVoOjzGjydCtw9gR3lp 0Z8h23ElM1KjXCBh4hMep9zl/NO8e8aL8XxujsrKkIM8RjlhV0X5UNoxOLDQCWgDbeiw ZA/ep+FgH10Uj4lcVMM+ZU1k+xb5UIMLNKkpr4GX5k9h47fYB2K6Qcuisc1DWbE0mAe1 xP2h6Q5JzPMoHJ+oZlI5GcgsiCQN6eRtHdCTe9prf1n3NxH39Opv3PA69DCzSkA2Hbfx ZoNw== X-Gm-Message-State: AOAM530XhNAYB0HQe8Oiike3esase/ZbFKvWVtwPjgbWZ/EK/XMN/4Tk 4vMM5c7nssxhVcMzmL4pOmNulwO7LnfBP8a18S8= X-Google-Smtp-Source: ABdhPJwHheK0aQYpzQBj5vB6v70rwAfEganFB3OYb/nONO4DIGcVKtmNijibpM8aulbcf22MMuVtfPeEtKKl9SAF/3Q= X-Received: by 2002:a17:902:d351:b029:db:e003:3b88 with SMTP id l17-20020a170902d351b02900dbe0033b88mr61169942plk.70.1609517438667; Fri, 01 Jan 2021 08:10:38 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 1 Jan 2021 10:10:38 -0600 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197135 Archived-At: Daniel Mart=C3=ADn writes: > Lars Ingebrigtsen writes: > >> Eli Zaretskii writes: >> >>>> --- a/src/alloc.c >>>> +++ b/src/alloc.c >>>> @@ -4001,7 +4001,7 @@ memory_full (size_t nbytes) >>>> { >>>> if (i =3D=3D 0) >>>> free (spare_memory[i]); >>>> - else if (i >=3D 1 && i <=3D 4) >>>> + else if (i <=3D 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 >>>=3D 1. > > I think it depends on the programmer. To me, the original code makes > more clear that the branch runs when i is in the [1..4] range, in a > mathematical sense. I liked the new one better myself, but we should probably just leave it alone if we can't agree. The difference is minor, in any case.