On Mon, 21 May 2012, Guy Helmer wrote:
Log:
Apply style(9) to return and switch/case statements.
Reviewed by: delphij (prior version of the patch)
Modified:
head/lib/libc/gen/getnetgrent.c
Modified: head/lib/libc/gen/getnetgrent.c
==============================================================================
--- head/lib/libc/gen/getnetgrent.c Mon May 21 19:58:40 2012
(r235738)
+++ head/lib/libc/gen/getnetgrent.c Mon May 21 21:04:29 2012
(r235739)
...
@@ -311,32 +311,35 @@ _revnetgr_lookup(char* lookupdom, char*
for (rot = 0; ; rot++) {
switch (rot) {
- case(0): snprintf(key, MAXHOSTNAMELEN, "%s.%s",
- str, dom?dom:lookupdom);
- break;
- case(1): snprintf(key, MAXHOSTNAMELEN, "%s.*",
- str);
- break;
- case(2): snprintf(key, MAXHOSTNAMELEN, "*.%s",
- dom?dom:lookupdom);
- break;
- case(3): snprintf(key, MAXHOSTNAMELEN, "*.*");
- break;
- default: return(0);
+ case(0):
+ snprintf(key, MAXHOSTNAMELEN, "%s.%s", str,
+ dom ? dom : lookupdom);
+ break;
+ case(1):
+ snprintf(key, MAXHOSTNAMELEN, "%s.*", str);
+ break;
+ case(2):
+ snprintf(key, MAXHOSTNAMELEN, "*.%s",
+ dom ? dom : lookupdom);
+ break;
+ case(3):
+ snprintf(key, MAXHOSTNAMELEN, "*.*");
+ break;
Thanks, but a fuller application would have removed the obfuscatory
parentheses that make case() look like a function call...
+ default: return (0);
... and split the case statements after ":" in all cases.
}
y = yp_match(lookupdom, map, key, strlen(key), &result,
&resultlen);
You fixed the continuation indentation in the case statement but not here.
if (y == 0) {
rv = _listmatch(result, group, resultlen);
free(result);
- if (rv) return(1);
+ if (rv) return (1);
Another statement not started on a new line.
} else if (y != YPERR_KEY) {
/*
* If we get an error other than 'no
* such key in map' then something is
* wrong and we should stop the search.
*/
- return(-1);
+ return (-1);
}
}
}
These style bugs weren't in the CSRG version of course. The YP code added
many. The most obvious ones are the case(n) and gnu-style continuation
indentation.
Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"