From: Daniel Stenberg Date: Sun, 30 Oct 2022 18:57:20 +0000 (+0100) Subject: tests/server: make use of strcasecompare from lib/ X-Git-Tag: curl-7_87_0~220 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02186a6605837ef0da39bfe39bf8a47f16d80920;p=thirdparty%2Fcurl.git tests/server: make use of strcasecompare from lib/ ... instead of having a second private implementation. Idea triggered by #9830 Closes #9831 --- diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc index ccc65d2b80..0c76712148 100644 --- a/tests/server/Makefile.inc +++ b/tests/server/Makefile.inc @@ -33,6 +33,7 @@ CURLX_SRCS = \ ../../lib/timediff.c \ ../../lib/dynbuf.c \ ../../lib/strdup.c \ + ../../lib/strcase.c \ ../../lib/curl_multibyte.c CURLX_HDRS = \ diff --git a/tests/server/util.c b/tests/server/util.c index d2214ee6e4..a0abf51903 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -367,31 +367,6 @@ void clear_advisor_read_lock(const char *filename) } -/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because - its behavior is altered by the current locale. */ -static char raw_toupper(char in) -{ - if(in >= 'a' && in <= 'z') - return (char)('A' + in - 'a'); - return in; -} - -int strncasecompare(const char *first, const char *second, size_t max) -{ - while(*first && *second && max) { - if(raw_toupper(*first) != raw_toupper(*second)) { - break; - } - max--; - first++; - second++; - } - if(0 == max) - return 1; /* they are equal this far */ - - return raw_toupper(*first) == raw_toupper(*second); -} - #if defined(WIN32) && !defined(MSDOS) static struct timeval tvnow(void)