From owner-freebsd-current@freebsd.org Fri Dec 27 18:07:52 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BB231CB17F for ; Fri, 27 Dec 2019 18:07:52 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47kvtv2gPwz4P4r for ; Fri, 27 Dec 2019 18:07:51 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id xBRI7nL4060738 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Fri, 27 Dec 2019 10:07:49 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id xBRI7nWw060737 for freebsd-current@freebsd.org; Fri, 27 Dec 2019 10:07:49 -0800 (PST) (envelope-from sgk) Date: Fri, 27 Dec 2019 10:07:49 -0800 From: Steve Kargl To: freebsd-current@freebsd.org Subject: Re: [PATCH] primes(6) -- remove unnecessary code Message-ID: <20191227180749.GA60730@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20191227175458.GA60597@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191227175458.GA60597@troutmask.apl.washington.edu> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47kvtv2gPwz4P4r X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=washington.edu (policy=none); spf=none (mx1.freebsd.org: domain of sgk@troutmask.apl.washington.edu has no SPF policy when checking 128.95.76.21) smtp.mailfrom=sgk@troutmask.apl.washington.edu X-Spamd-Result: default: False [-2.23 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[sgk@troutmask.apl.washington.edu]; DMARC_POLICY_SOFTFAIL(0.10)[washington.edu : No valid SPF, No valid DKIM,none]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE(-0.24)[ip: (0.05), ipnet: 128.95.0.0/16(-0.27), asn: 73(-0.92), country: US(-0.05)]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLYTO_ADDR_EQ_FROM(0.00)[]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:73, ipnet:128.95.0.0/16, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Dec 2019 18:07:52 -0000 On Fri, Dec 27, 2019 at 09:55:10AM -0800, Steve Kargl wrote: > This patch removes an unnecessary check as > the condition can never occur. > > Index: primes.c > =================================================================== > --- primes.c (revision 355983) > +++ primes.c (working copy) > @@ -129,7 +129,7 @@ > switch (argc) { > case 2: > /* Start and stop supplied on the command line. */ > - if (argv[0][0] == '-' || argv[1][0] == '-') > + if (argv[1][0] == '-') > errx(1, "negative numbers aren't permitted."); > > errno = 0; Hmm, I withdraw the patch. One can get a negative start value, but one would need to force that condition via a subversion via getopt. -- Steve