From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#35062: [PATCH 0/4] Trivial code cleanups Date: Mon, 01 Apr 2019 15:27:59 +0200 Message-ID: References: <1554071761.31929.0@yandex.ru> <20190331223742.1351-1-Hi-Angel@yandex.ru> <83d0m6gx30.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="107033"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35062@debbugs.gnu.org, Konstantin Kharlamov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 01 15:29:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAwzv-000Rfo-BK for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Apr 2019 15:29:11 +0200 Original-Received: from localhost ([127.0.0.1]:50142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAwzu-00061L-7G for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Apr 2019 09:29:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAwzn-0005zE-Oj for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:29:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAwzm-00004z-L8 for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAwzm-00004q-ES for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAwzm-0007T9-3y for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2019 09:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Apr 2019 13:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35062 X-GNU-PR-Package: emacs Original-Received: via spool by 35062-submit@debbugs.gnu.org id=B35062.155412529128645 (code B ref 35062); Mon, 01 Apr 2019 13:29:02 +0000 Original-Received: (at 35062) by debbugs.gnu.org; 1 Apr 2019 13:28:11 +0000 Original-Received: from localhost ([127.0.0.1]:38937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAwyx-0007Rx-Hj for submit@debbugs.gnu.org; Mon, 01 Apr 2019 09:28:11 -0400 Original-Received: from mail-wr1-f50.google.com ([209.85.221.50]:34065) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAwyt-0007Rh-MW for 35062@debbugs.gnu.org; Mon, 01 Apr 2019 09:28:10 -0400 Original-Received: by mail-wr1-f50.google.com with SMTP id p10so12069937wrq.1 for <35062@debbugs.gnu.org>; Mon, 01 Apr 2019 06:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=viN9u47ym4oL1nQw04On64tYP/IVZN9X9EyVwph6Gpg=; b=Y1ZDggYEMN1tmCOMaR7WdvsewRcimt1FkjEOnzEcQFTxmPSKi/1UrrAOBMNhJL1FI5 neTRG6W0/cqU5LfnJ6+JfNrJb2CevUYXpQq+X/J8CdJDej0QxZjgGodq+4uNibaQ92Gp 9PTHM/TA9ZG/h8RLzH4aQWB9QfVRfT2jqvr8qnVtYAD/9BwtQXsl+lUL03DJZlefLqQH X2Wai8ExCRJjq24Kb3QCwF4RJLQyUuhXNtQ60yU/KGopXMA2XeQxKEljx1o9UcQunLkE t9CAphnNEmDqB6PjZyUGM7xl98hScXS01sKMV5CHs2CkJwO5Wcnx3ejk5iGiXh2FaONM t5Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=viN9u47ym4oL1nQw04On64tYP/IVZN9X9EyVwph6Gpg=; b=iWukdSpvKn5zsOzTBzXpHLW8ib2NWzPeVtOqgjDZD/VzasinrKGDtjsX7f3D4eWw9c XRodCeae4RDkDyqJVJzv2oUF5DYvs8uVAr+s8KukqosE8D6nMptlEAPpSFRydZ3vOHFf LJr7eFn0k+jj8qXbl4B/dUD8ebFjFlofV9cGiHpJxvJOhhDmYIQe84S9+ztSQf3nJoYD ziF6rBjcdXPxh608Mj3r2cQ6ePIUIG/jqZSwXk7c30bBPZs4UwHjizvujEww75kPrLRu KRitbfQnu4FZMWj4W16VNs33ycELM7gT8nrBwmWHiz9Scm8xSk0dN+ZWlLgRWktICZfw +kzg== X-Gm-Message-State: APjAAAV3mBYzV9N7i535EdSZWnf/k79pTICS4jbrXwjHggvzbd5LPtjr XL4UWqFFhPzzWvE97VgoduMXZfiW X-Google-Smtp-Source: APXvYqzhpAg/1gGHKRw1R2oExh3kJiLTptXhbYIY/zipBT+3UuLWZxE9H4A674ItbVQrUA4PtQ9VoA== X-Received: by 2002:adf:ed90:: with SMTP id c16mr39336221wro.74.1554125281354; Mon, 01 Apr 2019 06:28:01 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id f10sm11929172wrs.17.2019.04.01.06.27.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 01 Apr 2019 06:28:00 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <83d0m6gx30.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 01 Apr 2019 07:37:23 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157021 Archived-At: >>>>> On Mon, 01 Apr 2019 07:37:23 +0300, Eli Zaretskii said: >> From: Konstantin Kharlamov Date: Mon, 1 >> Apr 2019 01:37:38 +0300 >>=20 >> These are mostly fixes of some of LGTM warnings >> https://lgtm.com/projects/g/emacs-mirror/emacs/alerts/?mode=3Dtree >>=20 >> Except the second patch, where I initially wanted to fix one >> warning, and as part of it I had to constify a variable to see >> that it is indeed immutable. And then I figured I could search >> through the code and find more similar places, where variables >> weren't marked as const. I like this cleanup because it is >> simple and trivially testable (i.e. if it compiles, then it's >> fine). FTR: there's still lots of opportunities for >> constification, I just stopped at some point. Eli> Thanks. Eli> I think the general policy is not to fix those except when Eli> making other changes in the same function, but I will let Eli> others comment. I=CA=BCd prefer it if the effort went to determining if eg the alert for 'type =3D 2' below was correct or not, proving the constness of variables is what we have a compiler for. xterm.c:5346 if (XSCROLL_BAR (bar)->x_window =3D=3D window_id && FRAME_X_DISPLAY (XFRAME (frame)) =3D=3D display && (type =3D 2 || (type =3D=3D 1 && XSCROLL_BAR (bar)->horizontal) || (type =3D=3D 0 && !XSCROLL_BAR (bar)->horizontal))) return XSCROLL_BAR (bar); Robert