[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140401101436.a5be0a7a9d832a373155ee3e@canb.auug.org.au>
Date: Tue, 1 Apr 2014 10:14:36 +1100
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Conrad Meyer <cse.cem@...il.com>, Conrad Meyer <cemeyer@...edu>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mark <markk@...ra.co.uk>
Subject: Re: [PATCH v2] fs: FAT: Add support for DOS 1.x formatted volumes
On Mon, 31 Mar 2014 15:32:32 -0700 Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Mon, 31 Mar 2014 15:21:17 -0700 Conrad Meyer <cse.cem@...il.com> wrote:
>
> > >> + if (get_unaligned_le16(&b->sector_size) != 0 || b->sec_per_clus != 0 ||
> > >> + b->reserved != 0 || b->fats != 0 ||
> > >> + get_unaligned_le16(&b->dir_entries) != 0 ||
> > >> + get_unaligned_le16(&b->sectors) != 0 || b->media != 0 ||
> > >> + b->fat_length != 0 || b->secs_track != 0 || b->heads != 0 ||
> > >> + b->secs_track != 0 || b->heads != 0)
> > >
> > > Impressive!
> >
> > I aim to please.
>
> No great improvements immediately occur to me ;)
>
> One could do
>
> /* nice comment */
> if (get_unaligned_le16(&b->sector_size) != 0)
> return;
> /* another nice comment */
> if (b->sec_per_clus != 0)
> return;
> ...
>
> but one would quickly run out of nice comments.
>
> You could do s/ != 0//g.
You could also put the boolean expression in a (hopefully expressively
named) helper function and do the tests separately there.
--
Cheers,
Stephen Rothwell sfr@...b.auug.org.au
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists