# HG changeset patch # User Matti Hamalainen # Date 1588095289 -10800 # Node ID fcaf2db0cd05a70192f8386e49fdd4e249000bae # Parent ec036e88a0c2f8033c3aced0296629db6a78cf2c Remove dm_str(n)casecmp() functions, in favour of standard libc ones. diff -r ec036e88a0c2 -r fcaf2db0cd05 src/dmlib.h --- a/src/dmlib.h Tue Apr 28 20:28:35 2020 +0300 +++ b/src/dmlib.h Tue Apr 28 20:34:49 2020 +0300 @@ -459,8 +459,6 @@ char * dm_strdup_vprintf(const char *fmt, va_list args); char * dm_strdup_printf(const char *fmt, ...); -int dm_strcasecmp(const char *haystack, const char *needle); -int dm_strncasecmp(const char *haystack, const char *needle, size_t n); char * dm_strrcasecmp(char *str, const char *needle); BOOL dmGetIntVal(const char *str, unsigned int *value, BOOL *neg); diff -r ec036e88a0c2 -r fcaf2db0cd05 src/dmstring.c --- a/src/dmstring.c Tue Apr 28 20:28:35 2020 +0300 +++ b/src/dmstring.c Tue Apr 28 20:34:49 2020 +0300 @@ -2,53 +2,6 @@ #include -/* Compare two strings ignoring case [strcasecmp, strncasecmp] - */ -int dm_strcasecmp(const char *haystack, const char *needle) -{ - const char *s1 = haystack, *s2 = needle; - assert(haystack != NULL); - assert(needle != NULL); - - if (haystack == needle) - return 0; - - while (*s1 && *s2) - { - int k = tolower(*s1) - tolower(*s2); - if (k != 0) - return k; - s1++; - s2++; - } - - return tolower(*s1) - tolower(*s2); -} - - -int dm_strncasecmp(const char *haystack, const char *needle, size_t n) -{ - const char *s1 = haystack, *s2 = needle; - assert(haystack != NULL); - assert(needle != NULL); - - if (haystack == needle) - return 0; - - while (n > 0 && *s1 && *s2) - { - int k = tolower(*s1) - tolower(*s2); - if (k != 0) - return k; - s1++; - s2++; - n--; - } - - return (n == 0) ? 0 : tolower(*s1) - tolower(*s2); -} - - /* Check if end of the given string str matches needle * case-insensitively, return pointer to start of the match, * if found, NULL otherwise. @@ -66,7 +19,7 @@ if (slen < nlen) return NULL; - if (dm_strcasecmp(str + slen - nlen, needle) == 0) + if (strcasecmp(str + slen - nlen, needle) == 0) return str + slen - nlen; else return NULL; diff -r ec036e88a0c2 -r fcaf2db0cd05 tools/fanalyze.c --- a/tools/fanalyze.c Tue Apr 28 20:28:35 2020 +0300 +++ b/tools/fanalyze.c Tue Apr 28 20:34:49 2020 +0300 @@ -310,13 +310,13 @@ char *vtmp = vspec; // Get endianess specifier, if any - if (dm_strncasecmp(vtmp, "le", 2) == 0) + if (strncasecmp(vtmp, "le", 2) == 0) { vendianess = TRUE; vtmp += 2; } else - if (dm_strncasecmp(vtmp, "be", 2) == 0) + if (strncasecmp(vtmp, "be", 2) == 0) { vendianess = FALSE; vtmp += 2; diff -r ec036e88a0c2 -r fcaf2db0cd05 tools/gfxconv.c --- a/tools/gfxconv.c Tue Apr 28 20:28:35 2020 +0300 +++ b/tools/gfxconv.c Tue Apr 28 20:34:49 2020 +0300 @@ -1065,7 +1065,7 @@ if (strcasecmp(topt, "alpha") == 0) optRemapMatchAlpha = TRUE; else - if (dm_strncasecmp(topt, "max=", 4) == 0) + if (strncasecmp(topt, "max=", 4) == 0) { char *start = topt + 4, *end; optRemapMaxDist = strtof(start, &end); @@ -1078,7 +1078,7 @@ } } else - if (dm_strncasecmp(topt, "nomatch=", 8) == 0) + if (strncasecmp(topt, "nomatch=", 8) == 0) { char *start = topt + 8, *end; optRemapNoMatchColor = strtol(start, &end, 10);