From owner-svn-src-all@freebsd.org Mon Aug 1 06:08:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E35EBAC406; Mon, 1 Aug 2016 06:08:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id DB4C11EDC; Mon, 1 Aug 2016 06:08:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 4482D1042AD1; Mon, 1 Aug 2016 16:08:06 +1000 (AEST) Date: Mon, 1 Aug 2016 16:08:05 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Xin Li cc: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, d@delphij.net Subject: Re: svn commit: r303600 - head/usr.bin/indent In-Reply-To: <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> Message-ID: <20160801155148.I884@besplex.bde.org> References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=NEAV23lmAAAA:8 a=6I5d2MoRAAAA:8 a=l6pahSjwQ7Of7pMpP0sA:9 a=CjuIK1q_8ugA:10 a=Bn2pgwyD2vrAyMmN8A2t:22 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 06:08:13 -0000 On Sun, 31 Jul 2016, Xin Li wrote: > On 7/31/16 14:36, Pedro F. Giffuni wrote: >> >> Log: >> indent(1): replace function call to bzero with memset. >> >> Reference: >> https://github.com/pstef/freebsd_indent/commit/7422f42f80099c69d34833d7106035dc09230235 >> >> Differential Revision: https://reviews.freebsd.org/D6966 (Partial) >> Submitted by: Piotr Stefaniak >> >> Modified: >> head/usr.bin/indent/io.c >> >> Modified: head/usr.bin/indent/io.c >> ============================================================================== >> --- head/usr.bin/indent/io.c Sun Jul 31 21:29:10 2016 (r303599) >> +++ head/usr.bin/indent/io.c Sun Jul 31 21:36:40 2016 (r303600) >> @@ -629,7 +629,7 @@ parsefont(struct fstate *f, const char * >> const char *s = s0; >> int sizedelta = 0; >> >> - bzero(f, sizeof *f); >> + memset(f, 0, sizeof(struct fstate)); > ^^^^^^^^^^^^^^^^^^^^^ This is much more error-prone > than sizeof(*f) IMHO. I also prefer bzero(). Removal of the space after sizeof is another regression. KNF disallows the space, but indent's style is very far from KNF. It isn't clear if indent's style is to require the space, since old versions of indent never used sizeof(typename), and 'sizeof object' requires the space. Regressions started in r93440 with sizeof(object) in an nitems() expansion. The style of this is very different from an nitems() expansion in r1590. There was 1 more sizeof(object) and 1 sizeof(int). This is the first sizeof(typename) where 'sizeof object' cannot be used for technical reasons. KNF also requires parentheses for sizeof(object). Then the space is unnecessary and disallowed. Bruce