From 02186a6605837ef0da39bfe39bf8a47f16d80920 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 30 Oct 2022 19:57:20 +0100 Subject: [PATCH] tests/server: make use of strcasecompare from lib/ ... instead of having a second private implementation. Idea triggered by #9830 Closes #9831 --- tests/server/Makefile.inc | 1 + tests/server/util.c | 25 ------------------------- 2 files changed, 1 insertion(+), 25 deletions(-) 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) -- 2.47.3