From owner-svn-src-all@FreeBSD.ORG Wed Oct 15 10:10:35 2008 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BACB10656A2; Wed, 15 Oct 2008 10:10:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 96F528FC19; Wed, 15 Oct 2008 10:10:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-84-14.carlnfd3.nsw.optusnet.com.au (c211-30-84-14.carlnfd3.nsw.optusnet.com.au [211.30.84.14]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m9FAALnF012290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 15 Oct 2008 21:10:24 +1100 Date: Wed, 15 Oct 2008 20:10:21 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Max Laier In-Reply-To: <200810141649.04834.max@love2party.net> Message-ID: <20081015195521.J43361@delplex.bde.org> References: <200810141226.m9ECQtPW006469@svn.freebsd.org> <48F4A9A5.8020605@inse.ru> <200810141649.04834.max@love2party.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Maxim Konovalov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Roman Kurakin , src-committers@FreeBSD.org Subject: Re: svn commit: r183881 - head/sys/netinet 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: Wed, 15 Oct 2008 10:10:35 -0000 On Tue, 14 Oct 2008, Max Laier wrote: > On Tuesday 14 October 2008 16:16:05 Roman Kurakin wrote: >>> ... >>> Log: >>> o Reformat ipfw nat get|setsockopt code to look it more >>> style(9) compliant. No functional changes. >>> >>> Modified: >>> head/sys/netinet/ip_fw2.c >>> >>> Modified: head/sys/netinet/ip_fw2.c >>> ========================================================================= >>> ===== --- head/sys/netinet/ip_fw2.c Tue Oct 14 10:23:11 2008 (r183880) +++ >>> head/sys/netinet/ip_fw2.c Tue Oct 14 12:26:55 2008 (r183881) @@ -4385,49 >>> +4385,52 @@ ipfw_ctl(struct sockopt *sopt) >>> break; >>> >>> case IP_FW_NAT_CFG: >>> - { >>> - if (IPFW_NAT_LOADED) >>> - error = ipfw_nat_cfg_ptr(sopt); >>> - else { >>> - printf("IP_FW_NAT_CFG: ipfw_nat not present, please load it.\n"); >>> - error = EINVAL; >>> + { >>> + if (IPFW_NAT_LOADED) >>> + error = ipfw_nat_cfg_ptr(sopt); >>> ... >> >> IMHO such indention does not add any usefulness, but increases indention >> level that is already very high. >> Also I do not see strict contradiction to the style(9), but probably I >> am not reading the most current style(9). style(9) certainly requires indentation for each level of {}. > The additional scope is absolutely unnecessary here and should be dropped - > IMHO. See case IP_FW_RESETLOG and above. The bogus {} are probably left over from another style bug -- nested declarations. One reason that style(9) forbids nested declarations is that they require the extra scope (except now using C99 (*)). Too-large case statements sometimes want to use different local variables for each case. To prevent the indentation reaching column 800, the formatting in the original version of the above is sometimes used. But this is just abnother layer of style bugs if the case statement doesn't even have local variables. (*) In C99, you can write: int foo; use (foo); too easily and not even notice that to properly violate style(9)'s nesting rule you should have written: { /* bletch */ int foo; use (foo); } or that to not violate style(9) you should have written: int a, b, c, d, e, f, foo, ...; /* sort foo into function's decls */ ... use(foo); style(9) doesn't allow the C99 declaration since C99 hasn't noticed that C99 exists. Bruce