From 4263479e70456c1aa4568c10a4412ad4ddf6df38 Mon Sep 17 00:00:00 2001 From: Nikolaos Chatzikonstantinou Date: Fri, 10 Feb 2023 23:24:20 +0200 Subject: [PATCH] use strncasecmp in ares__strsplit (#512) strncasecmp on platforms that don't already have it is already #define'd to a private implementation. There is no need to have OS-specific logic. Also removes ares__strsplit.h as a header as ares_private.h already includes it. Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount) --- src/lib/ares_strsplit.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/lib/ares_strsplit.c b/src/lib/ares_strsplit.c index 194375c8..d3e90c4a 100644 --- a/src/lib/ares_strsplit.c +++ b/src/lib/ares_strsplit.c @@ -18,7 +18,6 @@ #endif #include "ares_setup.h" -#include "ares_strsplit.h" #include "ares.h" #include "ares_private.h" @@ -55,7 +54,7 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) { count++; p += i; } - } while(*p++ != 0); + } while (*p++ != 0); if (count == 0) return NULL; @@ -69,13 +68,8 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) { i = strcspn(p, delms); if (i != 0) { for (k = 0; k < j; k++) { -#ifdef WIN32 - if (strnicmp(table[k], p, i) == 0 && table[k][i] == 0) - break; -#else if (strncasecmp(table[k], p, i) == 0 && table[k][i] == 0) break; -#endif } if (k == j) { /* copy unique strings only */