Date: Tue, 18 Mar 2003 23:53:39 -0800 (PST) From: Doug Barton <DougB@FreeBSD.org> To: cjclark@alum.mit.edu Cc: current@FreeBSD.org Subject: Re: Create linker.hints at boot Message-ID: <20030318235118.O88684@znfgre.tberna.bet> In-Reply-To: <20030317222815.GB98963@blossom.cjclark.org> References: <20030315000920.GA69495@blossom.cjclark.org> <20030315032742.3AE132A7EA@canning.wemm.org> <20030317082834.GC24317@blossom.cjclark.org> <20030317171112.GA32128@dragon.nuxi.com> <20030317204319.GA98963@blossom.cjclark.org> <20030317210753.GA35762@dragon.nuxi.com> <20030317222815.GB98963@blossom.cjclark.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 17 Mar 2003, Crist J. Clark wrote:
> On Mon, Mar 17, 2003 at 01:07:53PM -0800, David O'Brien wrote:
> > On Mon, Mar 17, 2003 at 12:43:19PM -0800, Crist J. Clark wrote:
> > > On Mon, Mar 17, 2003 at 09:11:12AM -0800, David O'Brien wrote:
> > > > On Mon, Mar 17, 2003 at 12:28:34AM -0800, Crist J. Clark wrote:
> > > > > +kldxref_start () {
> > > > > + if [ -z "$kldxref_module_path" ]; then
> > > > > + MODULE_PATHS=`sysctl -n kern.module_path`
> > > > > + else
> > > > > + MODULE_PATHS="$kldxref_module_path"
> > > > > + fi
> > > >
> > > > Please change the logic to positive logic:
> > > >
> > > > if [ -n "$kldxref_module_path" ]; then
> > > > MODULE_PATHS="$kldxref_module_path"
> > > > else
> > > > MODULE_PATHS=`sysctl -n kern.module_path`
> > > > fi
> > >
> > > Is there a technical reason for that or is it just a "style" issue?
> >
> > Style, easier to read out loud, easier to understand w/o having to think.
> > Just like this is hard to "read". It certainly doesn't do what one reads
> > out loud: "if not string compaire equal".
> >
> > if (!strcmp(a,b) {
> > printf("same\n");
> > }
>
> I don't see what that code snipit has to do with the script (but I am
> in the camp that would go ahead and waste the four bytes of source
> code to write that as (strcmp(a, b) == 0)).
>
> I _did_ write the original script the way I was thinking/would say it,
>
> "If $kldxref_module_path is empty, use the sysctl(8), otherwise, use
> its contents."
>
> I guess I was thinking of '-z' as a positive, "is empty," rather than
> a negative, "is not filled."
>
> But whatever. I've changed it to the "positive" in my repository. I'll
> commit the latest version later and everyone can make there own
> fixes/additions/changes/PRs.
Not that this issue needs this level of analysis, but I like to optimize
for the most likely case. Both to make the code a little tighter, but in
the case of things like startup scripts, it reduces the likelihood that an
edge case code path will pop up unexpectedly and render something
unbootable.
Doug
--
This .signature sanitized for your protection
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030318235118.O88684>
