Date: Sun, 28 Jan 2018 11:08:19 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Ian Lepore <ian@freebsd.org> Cc: Conrad Meyer <cem@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune Message-ID: <20180128102559.X4216@besplex.bde.org> In-Reply-To: <1517094539.1517.9.camel@freebsd.org> References: <201801271743.w0RHh9io022619@repo.freebsd.org> <CAG6CVpUOxtE9p8OApL6LsUJWh5tTM_9647M0qe5VNSnTTSEvQw@mail.gmail.com> <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org> <CAG6CVpXXUSPwUsxqXhJBfq_f-FwFAWXO4uQu4f2evWet90fBNg@mail.gmail.com> <1517094539.1517.9.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Jan 2018, Ian Lepore wrote: > On Sat, 2018-01-27 at 22:56 +0000, Conrad Meyer wrote: >> I don=FFt think dragonfly has anything to do with this?=A0=A0If you=FFre >> converting >> bool increments to setting true values in FreeBSD, use >> =B4true.=A1=A0=A0That=FFs all >> there is to it. > > style(9) emphasizes internal consistancy in several places. =A0The > uppercase TRUE/FALSE is currently the style within that code, so it > makes sense to stick with it. =A0If a (somewhat gratuitous) conversion to > the new style is made, it should be a separate commit just for that, > emphasizing that it changes just style and not functionality. fortune.c has already been churned and broken by gratuitous conversion to use bool. It used to use "#define bool short". It also defined its own TRUE and FALS= E as 1 and 0. This was almost correct. The bools were sometimes set bogusly to TRUE using the PDP-11 micro-optimization of incrementing them (this can overflow in theory, but in practice it is hard to have enough command line args to overflow even short variables by incrementing them by 1 per arg). The `Debug' variable was tri-state, but its type was misspelled bool and it was bogusly initialized to FALSE. This was changed in r242576 by including <stdbool.h>, removing the private definition of bool, and changing the definitions of TRUE and FALSE to true and false. This did no good, but exposed the brokenness of 'Debug' and created mounds of style bugs (spelling true and false as TRUE and FALSE, and requiring more magic for the PDP-11ism's to work). r242577 increased the style bugs by using true and false directly in new code. 'Debug' was fixed in r243036. This commit is to remove the PDP11-isms. Although they work even better with real bools than with shorts (incrementing a bool clamps it to 1, but incrementing a short always increments it unless it overflows), they are larger obfuscations with bools than with shorts and some compilers apparently warn about them. This commit preserves the old style of using TRUE and FALSE instead of true and false. style(9) only mildly discourages converting old code to use bool ("may be converted if it is reasonable to"). It says that the spellings true and false are preferred, but should only say that the are preferred in code that uses bool. Bruce From owner-svn-src-all@freebsd.org Sun Jan 28 00:26:06 2018 Return-Path: <owner-svn-src-all@freebsd.org> Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C8F2ECD91B; Sun, 28 Jan 2018 00:26:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D64848200F; Sun, 28 Jan 2018 00:26:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D139111F2B; Sun, 28 Jan 2018 00:26:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0S0Q5os021746; Sun, 28 Jan 2018 00:26:05 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0S0Q578021745; Sun, 28 Jan 2018 00:26:05 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801280026.w0S0Q578021745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler <eadler@FreeBSD.org> Date: Sun, 28 Jan 2018 00:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328502 - stable/11/usr.bin/limits X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/limits X-SVN-Commit-Revision: 328502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" <svn-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/> List-Post: <mailto:svn-src-all@freebsd.org> List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Sun, 28 Jan 2018 00:26:06 -0000 Author: eadler Date: Sun Jan 28 00:26:05 2018 New Revision: 328502 URL: https://svnweb.freebsd.org/changeset/base/328502 Log: MFC r328212: limits(1): fix always true condition Modified: stable/11/usr.bin/limits/limits.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/limits/limits.c ============================================================================== --- stable/11/usr.bin/limits/limits.c Sat Jan 27 23:40:41 2018 (r328501) +++ stable/11/usr.bin/limits/limits.c Sun Jan 28 00:26:05 2018 (r328502) @@ -509,7 +509,7 @@ main(int argc, char *argv[]) for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) { if (doall || num_limits == 0 || which_limits[rcswhich] != 0) { - if (which_limits[rcswhich] == ANY || which_limits[rcswhich]) + if (which_limits[rcswhich] == ANY) which_limits[rcswhich] = type; if (shellparm[shelltype].lprm[rcswhich].pfx) { if (shellparm[shelltype].both && limits[rcswhich].rlim_cur == limits[rcswhich].rlim_max) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180128102559.X4216>