Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Aug 2016 16:08:05 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Xin Li <delphij@delphij.net>
Cc:        "Pedro F. Giffuni" <pfg@freebsd.org>, 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:  <20160801155148.I884@besplex.bde.org>
In-Reply-To: <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net>
References:  <201607312136.u6VLaeRb058693@repo.freebsd.org> <8d6114b7-cd71-239a-dcc4-03a6d568482c@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160801155148.I884>