svn commit: r265845 - head/lib/libc/gen

Bruce Evans brde at optusnet.com.au
Sun May 11 03:17:58 UTC 2014


On Sat, 10 May 2014, Konstantin Belousov wrote:

> Log:
>  Style.

Thanks, but this adds a style bug of the same type as one that it removes.

> Modified: head/lib/libc/gen/sem_new.c
> ==============================================================================
> --- head/lib/libc/gen/sem_new.c	Sat May 10 17:42:21 2014	(r265844)
> +++ head/lib/libc/gen/sem_new.c	Sat May 10 18:59:09 2014	(r265845)
> @@ -294,13 +294,13 @@ _sem_unlink(const char *name)
> 		return -1;
> 	}
> 	name++;
> -

Was an extra blank line.

> 	strcpy(path, SEM_PREFIX);
> 	if (strlcat(path, name, sizeof(path)) >= sizeof(path)) {
> 		errno = ENAMETOOLONG;
> 		return (-1);
> 	}
> -	return unlink(path);
> +

Now an extra blank line.

> +	return (unlink(path));
> }
>
> int

Statements are not separated by blank lines in KNF except in exceptional
circumstances.  In strict KNF, even blocks starting with a block comment
are not separated by blank lines.  This is too much for me, so my rule
is to always use blank lines for sections beginning with a comment and
rarely use them otherwise (maybe every 20 lines).

This file has several other style bugs.  indent(1) fixes the following
formatting ones:
- trailing whitespace
- missing indentation in struct declaration
- doubled spaces after &ma
- several more instances of an extra blank line
- missing spaces around binary operators (about 10 instances)
- non-cuddled else
- non-KNF continuation indentation
- missing space after 'while'
indent(1) doesn't understand its own -lp option and fails to fix long
lines and otherwise miswrapped lines, except for the continuation
indentation.

Variant formatting of extra blank lines (to remove the one that you
removed and add the one that you added) would be impossibly difficult
for indent(1) to fix or preserve.

Non-formatting style bugs are harder to fix.  Altogether, there are style
bugs on about 10% of lines.  Below average ugliness.

Bruce


More information about the svn-src-all mailing list