From owner-svn-src-all@FreeBSD.ORG Wed Sep 5 04:18:52 2012 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 7FCBA1065670; Wed, 5 Sep 2012 04:18:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx10.syd.optusnet.com.au (fallbackmx10.syd.optusnet.com.au [211.29.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id 132C48FC0C; Wed, 5 Sep 2012 04:18:51 +0000 (UTC) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by fallbackmx10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q854Io7f015497; Wed, 5 Sep 2012 14:18:50 +1000 Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q854IeVb011549 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 5 Sep 2012 14:18:42 +1000 Date: Wed, 5 Sep 2012 14:18:40 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Aleksandr Rybalko In-Reply-To: <201209042316.q84NGtuA035023@svn.freebsd.org> Message-ID: <20120905135841.D1053@besplex.bde.org> References: <201209042316.q84NGtuA035023@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: r240119 - head/sys/kern 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, 05 Sep 2012 04:18:52 -0000 On Tue, 4 Sep 2012, Aleksandr Rybalko wrote: > Log: > Style fixes. > > Suggested by: mdf > Approved by: adrian (menthor) The following style bugs remain. (The density of style bugs is low enough for them to be easy to fix.) > Modified: head/sys/kern/subr_hints.c > ============================================================================== > --- head/sys/kern/subr_hints.c Tue Sep 4 23:13:24 2012 (r240118) > +++ head/sys/kern/subr_hints.c Tue Sep 4 23:16:55 2012 (r240119) > @@ -31,8 +31,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > -#include > #include > +#include Sorting this correctly would be an unrelated fix (it is a prerequisite for most headers, since almost any header may use KASSERT()). > #include Sorting this correctly woruld be an unrelated fix. > > /* > @@ -52,9 +52,9 @@ static char *hintp; Sorting and indenting the static variables would be an unrelated fix. > static int > sysctl_hintmode(SYSCTL_HANDLER_ARGS) A bug in svn diff is visible. The variable declaration is worse than useless as a header for this block of code. > { > - int error, i, from_kenv, value, eqidx; > const char *cp; > char *line, *eq; > + int eqidx, error, from_kenv, i, value; > > from_kenv = 0; > cp = kern_envp; > @@ -62,7 +62,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) > > /* Fetch candidate for new hintmode value */ Comments (except possibly ones at the right of code) should be real sentences. This one is missing a ".", unlike all older comments (not at the right of code) in this file. > error = sysctl_handle_int(oidp, &value, 0, req); > - if (error || !req->newptr) > + if (error || req->newptr == NULL) > return (error); > > if (value != 2) This still has a boolean test for the non-boolean `error'. Now the older code sets a bad example in all cases where `error' is tested. > @@ -73,8 +73,11 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) > switch (hintmode) { > case 0: > if (dynamic_kenv) { > - /* Already here */ > - hintmode = value; /* XXX: Need we switch or not ? */ > + /* > + * Already here. But assign hintmode to 2, to not > + * check it in the future. > + */ Sentence breaks should be 2 spaces, as in all older comments in this file, starting as usual with the copyright. But outside of the copyright, the style bug of single-space sentence breaks was avoided in this file mostly by using the larger style bug of using a new line for most new sentences. > + hintmode = 2; > return (0); > } > from_kenv = 1; > @@ -98,7 +101,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) > continue; > } > eq = strchr(cp, '='); > - if (!eq) > + if (eq == NULL) > /* Bad hint value */ > continue; > eqidx = eq - cp; Bruce