From 9d16b4081ed011c11f9876ae2685076e92113593 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Oct 2008 08:23:48 +0000 Subject: Renamed Curl_ascii_equal to Curl_raw_equal and bugfixed the my_toupper function used in strequal.c so now all test cases run fine for me again. --- lib/strequal.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/strequal.c') diff --git a/lib/strequal.c b/lib/strequal.c index 53654c68a..5065b3871 100644 --- a/lib/strequal.c +++ b/lib/strequal.c @@ -78,7 +78,7 @@ int curl_strnequal(const char *first, const char *second, size_t max) /* Portable toupper (remember EBCDIC). Do not use tupper() because its behavior is altered by the current locale. */ -static bool my_toupper(unsigned char in) +static unsigned char my_toupper(unsigned char in) { switch (in) { case 'a': @@ -138,17 +138,18 @@ static bool my_toupper(unsigned char in) } /* - * Curl_ascii_equal() is for doing "ascii" case insensitive strings. This is - * meant to be locale independent and only compare strings we know are safe - * for this. - * See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for some - * further explanation to why this function is necessary. + * Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant + * to be locale independent and only compare strings we know are safe for + * this. See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for + * some further explanation to why this function is necessary. + * + * The function is capable of comparing a-z case insensitively even for non-ascii. */ -int Curl_ascii_equal(const char *first, const char *second) +int Curl_raw_equal(const char *first, const char *second) { while(*first && *second) { - if(! (my_toupper(*first) == my_toupper(*second))) + if(my_toupper(*first) != my_toupper(*second)) /* get out of the loop as soon as they don't match */ break; first++; -- cgit v1.2.3