Re: 2.1.120pre2: Bug in strnicmp() noted in 2.1.119pre1 is still there!

Robert Hamilton (hamil@phys.physics.tamu.edu)
Tue, 1 Sep 1998 17:51:22 -0500


On Mon, Aug 31, 1998 at 10:29:28AM -0700, Linus Torvalds wrote:
> Ok, shoot holes in this one instead.
>
> Linus

Say, it looks like you can save an occasional subtraction if you
replace the sequence

> c1 = tolower(c1);
> c2 = tolower(c2);

with:
--------------------------------
if(islower(c2))
if(isupper(c1))
c1-='A'-'a';
else /* c1 c2 same case */
goto different;
else /* c2 is upper case */
if(islower(c1))
c1-='a'-'A';
else /* c1 c2 same case */
goto different;
----------------------------------------------
The extra subtraction is saved by the "else goto's" when it becomes
clear you don't have to convert the case of c1.

Robert

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html