Remove fallback strcasecmp/strncasecmp Sorry if your libc doesn't have this, but it's not my problem. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reported-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
diff --git a/configure.ac b/configure.ac
index 786556c..724fe0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,11 @@ if test ! -f "src/xkbcomp/xkbparse.c"; then
fi
# Checks for library functions.
-AC_CHECK_FUNCS([strcasecmp])
+AC_CHECK_FUNCS([strcasecmp strncasecmp])
+if test "x$ac_cv_func_strcasecmp" = xno || \
+ test "x$ac_cv_func_strncasecmp" = xno; then
+ AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
+fi
# Build native compiler needed for makekeys
AC_ARG_VAR([CC_FOR_BUILD], [Build native C compiler program])
diff --git a/src/utils.c b/src/utils.c
index 0ba389b..095c2d1 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -196,57 +196,3 @@ uInternalError(const char *s, ...)
fflush(errorFile);
outCount++;
}
-
-/***====================================================================***/
-
-#ifndef HAVE_STRCASECMP
-int
-uStrCaseCmp(const char *str1, const char *str2)
-{
- char buf1[512], buf2[512];
- char c, *s;
- int n;
-
- for (n = 0, s = buf1; (c = *str1++); n++)
- {
- if (isupper(c))
- c = tolower(c);
- if (n > 510)
- break;
- *s++ = c;
- }
- *s = '\0';
- for (n = 0, s = buf2; (c = *str2++); n++)
- {
- if (isupper(c))
- c = tolower(c);
- if (n > 510)
- break;
- *s++ = c;
- }
- *s = '\0';
- return (strcmp(buf1, buf2));
-}
-
-int
-uStrCasePrefix(const char *my_prefix, char *str)
-{
- char c1;
- char c2;
- while (((c1 = *my_prefix) != '\0') && ((c2 = *str) != '\0'))
- {
- if (isupper(c1))
- c1 = tolower(c1);
- if (isupper(c2))
- c2 = tolower(c2);
- if (c1 != c2)
- return 0;
- my_prefix++;
- str++;
- }
- if (c1 != '\0')
- return 0;
- return 1;
-}
-
-#endif