summaryrefslogtreecommitdiff
path: root/lib/strequal.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-10-16 08:23:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-10-16 08:23:48 +0000
commit9d16b4081ed011c11f9876ae2685076e92113593 (patch)
tree566029901ed6edccdc424814d068c9db75723d2c /lib/strequal.c
parent545cafce9b81f4bda89072a5ebb2d1632f10dc44 (diff)
downloadcurl-9d16b4081ed011c11f9876ae2685076e92113593.tar.gz
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.
Diffstat (limited to 'lib/strequal.c')
-rw-r--r--lib/strequal.c17
1 files changed, 9 insertions, 8 deletions
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++;