svn commit: r213662 - in head: sbin/geom/class/concat sbin/geom/class/eli sbin/geom/class/journal sbin/geom/class/mirror sbin/geom/class/part sbin/geom/class/raid3 sbin/geom/class/shsec sbin/geom/c...

John Baldwin jhb at freebsd.org
Mon Oct 11 18:13:37 UTC 2010


On Sunday, October 10, 2010 4:54:37 am Ivan Voras wrote:
> On 9 October 2010 22:20, Andrey V. Elsukov <ae at freebsd.org> wrote:
> > Author: ae
> > Date: Sat Oct  9 20:20:27 2010
> > New Revision: 213662
> > URL: http://svn.freebsd.org/changeset/base/213662
> >
> > Log:
> >  Replace strlen(_PATH_DEV) with sizeof(_PATH_DEV) - 1.
> 
> Um, this looks like a pointless change and for the worse; Even at -O1
> the compiler will reduce strlen(constant) to just its result and for
> code like printf("%d\n", sizeof("1234567")) produce code like:
> 
> 	movl	$7, %esi
> 	movl	$.LC0, %edi
> 	movl	$0, %eax
> 	call	printf
> 
> And (though tastes differ) I think the sizeof() variant is less
> readable. The strlen(_PATH_something) idiom is common in other parts
> of the kernel outside GEOM.
> 
> In short - why was this done?

I agree, strlen("foo") is much clearer.

-- 
John Baldwin


More information about the svn-src-head mailing list