2007-05-28 01:08:49

by Dave Young

[permalink] [raw]
Subject: [patch -mm 1/1] remove useless tolower in isofs

Hi,
Remove useless tolower in isofs

Signed-off-by: dave young <[email protected]>

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);

Regards
dave


2007-05-28 02:53:40

by John Anthony Kazos Jr.

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

> Hi,
> Remove useless tolower in isofs
>
> Signed-off-by: dave young <[email protected]>
>
> 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.)

2007-05-28 03:11:18

by Dave Young

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

Hi,
> 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.)
>

IMO, I like the last one, but I prefer to keep the original author's
one, I only remove the unnecessary tolower function.
What do you think about this , Andrew?

Regards
dave

2007-05-28 06:00:49

by Pekka Enberg

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

On 5/28/07, young dave <[email protected]> wrote:
> Remove useless tolower in isofs

[snip]

> c = tolower(*name++);
> - hash = partial_name_hash(tolower(c), hash);
> + hash = partial_name_hash(c, hash);

Looks good to me.

Acked-by: Pekka Enberg <[email protected]>

2007-05-28 10:10:58

by Dave Young

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

Hi,
Thanks, can this small fix be merged?

2007-05-28 10:16:23

by Pekka Enberg

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

On 5/28/07, young dave <[email protected]> wrote:
> Thanks, can this small fix be merged?

Yes. Please be patient and wait for Andrew to pick it up.

2007-05-29 23:17:58

by Andrew Morton

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

On Mon, 28 May 2007 03:11:04 +0000
"young dave" <[email protected]> wrote:

> Hi,
> > 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.)
> >
>
> IMO, I like the last one, but I prefer to keep the original author's
> one, I only remove the unnecessary tolower function.
> What do you think about this , Andrew?
>

Don't care much. The code as it stands is suitably paranoid about
buggy implementations of tolower() which evaluate their arg more
than once ;)

Your email client replaces tabs with spaces.

2007-05-30 00:20:20

by Dave Young

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

Hi,
Thank you, andrew.

> Your email client replaces tabs with spaces.

Really? I use gmail web via firefox, next time I will use mutt to
send patches.

Regards
dave

2007-05-30 05:32:31

by Dave Young

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

Hi,

> Your email client replaces tabs with spaces.

The tabs replacing was caused by copying them from vi session in
gnome-terminal. I find the proper way is to copy them from some gui
editor.

Regards
dave