Date: Mon, 1 Aug 2016 11:08:51 -0500 From: Pedro Giffuni <pfg@FreeBSD.org> To: Bruce Evans <brde@optusnet.com.au>, Xin Li <delphij@delphij.net> Cc: 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 Message-ID: <809fadc7-0ac1-2f50-1d77-588e1b756302@FreeBSD.org> In-Reply-To: <20160801155148.I884@besplex.bde.org> References: <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net> <20160801155148.I884@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 08/01/16 01:08, Bruce Evans wrote: > 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(). > bzero --> memset changes are done to ease portability ... On another BSD such replacements were done for performance but then they discovered it was their bzero that was broken. > 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. OK ... that was in 2002. We are using nitems() now, which undoes the portability meant to be brought by memset. OTOH, using sys/param.h is implicit permission to use nitems() and may involve other portability issues already. Can't keep everybody happy. Pedro.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?809fadc7-0ac1-2f50-1d77-588e1b756302>