From owner-svn-src-all@FreeBSD.ORG Tue May 22 06:48:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A578106566C; Tue, 22 May 2012 06:48:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au [211.29.132.198]) by mx1.freebsd.org (Postfix) with ESMTP id C7CC98FC12; Tue, 22 May 2012 06:48:18 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q4M6m81e004473 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 May 2012 16:48:10 +1000 Date: Tue, 22 May 2012 16:48:08 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Guy Helmer In-Reply-To: <201205212104.q4LL4UDN072617@svn.freebsd.org> Message-ID: <20120522163814.T1056@besplex.bde.org> References: <201205212104.q4LL4UDN072617@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r235739 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 06:48:19 -0000 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