Re: [patch -mm 1/1] remove useless tolower in isofs

From: John Anthony Kazos Jr.
Date: Sun May 27 2007 - 22:53:42 EST


> Hi,
> Remove useless tolower in isofs
>
> Signed-off-by: dave young <hidave.darkstar@xxxxxxxxx>
>
> inode.c | 2 +-
> 1 file changed, 1 insertions(+), 1 deletions(-)
>
> diff -dur linux/fs/isofs/inode.c linux.new/fs/isofs/inode.c
> --- linux/fs/isofs/inode.c 2007-05-28 08:54:33.000000000 +0000
> +++ linux.new/fs/isofs/inode.c 2007-05-28 08:55:02.000000000 +0000
> @@ -197,7 +197,7 @@
> hash = init_name_hash();
> while (len--) {
> c = tolower(*name++);
> - hash = partial_name_hash(tolower(c), hash);
> + hash = partial_name_hash(c, hash);
> }
> qstr->hash = end_name_hash(hash);

How about this? A lot more readable and doesn't even need an intermediate
value.

for (; len; len--, name++) {
hash = partial_name_hash(tolower(*name), hash);
}

Or if you don't think that way is more readable, how about this?

while (len) {
hash = partial_name_hash(tolower(*name), hash);
name++;
len--;
}

And then there's the supercompact form.

while (len--) {
hash = partial_name_hash(tolower(*name++), hash);
}

But I do not like the last one at all. The first one is the best, because
it clearly separates the condition and iteration parts of the expression,
while STILL being only three lines long. Or two, if you omit the braces.
(But you shouldn't.)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/