summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-22 12:52:26 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-22 12:52:26 -0700
commitb4c6069ecc1a6b03051e06aecba04e828fb0d945 (patch)
tree5bd853a4fe507c27b9846bb4de3e79e904c8c9ee
parent948cbfb38a76df395e7d9458c472901bcfefb969 (diff)
Assume target platforms have strcasecmp now
It has been required since Unix98/SUSv2 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/18>
-rw-r--r--configure.ac2
-rw-r--r--meson.build1
-rw-r--r--src/XKBfileInt.h7
-rw-r--r--src/xkbmisc.c16
4 files changed, 2 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index 4d6ea50..334f5b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,7 +42,7 @@ XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
# Checks for library functions.
-AC_CHECK_FUNCS([strcasecmp strndup])
+AC_CHECK_FUNCS([strndup])
AC_CHECK_FUNC(getc_unlocked, AC_DEFINE([HAVE_UNLOCKED_STDIO], 1,
['Unlocked stdio']), [])
diff --git a/meson.build b/meson.build
index 22ded80..749c106 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,6 @@ project('libxkbfile', 'c',
cc = meson.get_compiler('c')
cc_conf = configuration_data({
- 'HAVE_STRCASECMP': cc.has_function('strcasecmp') ? '1' : false,
'HAVE_STRNDUP': cc.has_function('strndup') and
cc.has_header_symbol('string.h', 'strndup') ? '1' : false,
'HAVE_UNLOCKED_STDIO': cc.has_function('getc_unlocked') ? '1' : false
diff --git a/src/XKBfileInt.h b/src/XKBfileInt.h
index e0332cb..13b63e6 100644
--- a/src/XKBfileInt.h
+++ b/src/XKBfileInt.h
@@ -29,6 +29,7 @@
#include "XKBfile.h"
#include <string.h>
+#include <strings.h>
#ifdef DEBUG
#define _XkbLibError(c,l,d) \
@@ -68,13 +69,7 @@ _XkbDupString(const char *s)
}
#define _XkbStrCaseEqual(s1,s2) (_XkbStrCaseCmp(s1,s2)==0)
-
-#ifndef HAVE_STRCASECMP
-extern int _XkbStrCaseCmp(char *s1, char *s2);
-#else
#define _XkbStrCaseCmp strcasecmp
-#include <strings.h>
-#endif
_XFUNCPROTOEND
#endif /* _XKBFILEINT_H_ */
diff --git a/src/xkbmisc.c b/src/xkbmisc.c
index b025048..6d80d6a 100644
--- a/src/xkbmisc.c
+++ b/src/xkbmisc.c
@@ -683,19 +683,3 @@ XkbNameMatchesPattern(char *name, char *ptrn)
/* if we get here, the pattern is exhausted (-:just like me:-) */
return (name[0] == '\0');
}
-
-#ifndef HAVE_STRCASECMP
-_X_HIDDEN int
-_XkbStrCaseCmp(char *str1, char *str2)
-{
- const u_char *us1 = (const u_char *) str1, *us2 = (const u_char *) str2;
-
- while (tolower(*us1) == tolower(*us2)) {
- if (*us1++ == '\0')
- return (0);
- us2++;
- }
-
- return (tolower(*us1) - tolower(*us2));
-}
-#endif