summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-03-27 22:28:32 +0000
committerDaniel Stone <daniel@fooishbar.org>2006-03-27 22:28:32 +0000
commit5be8a66d324f3d5840b134ad29069eace64e6f12 (patch)
tree23f328fd517ab2c55e09b484912390b58dfdae70
parent9e202dfe40e2bdd66f461a6ba531e927f82096ae (diff)
Fix remnants of previous busted _XkbStrCaseCmp commit.
-rw-r--r--ChangeLog3
-rw-r--r--configure.ac2
-rw-r--r--hw/xfree86/dixmods/xkbPrivate.c8
-rw-r--r--include/xkb-config.h.in3
-rw-r--r--xkb/maprules.c14
-rw-r--r--xkb/xkbfmisc.c16
6 files changed, 38 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ea4320d6..20d4bf3a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,8 +18,11 @@
prototype to xkb.h.
Explicitly initialise nTypes in xkb.c.
+ * configure.ac:
+ * include/xkb-config.h.in:
* xkb/xkbfmisc.c:
* xkb/maprules.c:
+ * hw/xfree86/dixmods/xkbPrivate.c:
Bug #3819: Remove open-coding of strcasecmp.
* xkb/ddxVT.c:
diff --git a/configure.ac b/configure.ac
index a35ac1608..aad004338 100644
--- a/configure.ac
+++ b/configure.ac
@@ -727,6 +727,8 @@ REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
+AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
+ [Do not have `strcasecmp'.]))
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
if test "x$have_libxdmcp" = xyes; then
diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c
index b632ecb89..0479bcac3 100644
--- a/hw/xfree86/dixmods/xkbPrivate.c
+++ b/hw/xfree86/dixmods/xkbPrivate.c
@@ -26,13 +26,13 @@ XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act)
if (xf86act->type == XkbSA_XFree86Private) {
memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize);
msgbuf[XkbAnyActionDataSize]= '\0';
- if (_XkbStrCaseCmp(msgbuf, "-vmode")==0)
+ if (strcmp(msgbuf, "-vmode")==0)
xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- else if (_XkbStrCaseCmp(msgbuf, "+vmode")==0)
+ else if (strcmp(msgbuf, "+vmode")==0)
xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- else if (_XkbStrCaseCmp(msgbuf, "ungrab")==0)
+ else if (strcmp(msgbuf, "ungrab")==0)
xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
- else if (_XkbStrCaseCmp(msgbuf, "clsgrb")==0)
+ else if (strcmp(msgbuf, "clsgrb")==0)
xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
else
xf86ProcessActionEvent(ACTION_MESSAGE, (void *) msgbuf);
diff --git a/include/xkb-config.h.in b/include/xkb-config.h.in
index 25cceb031..29261def7 100644
--- a/include/xkb-config.h.in
+++ b/include/xkb-config.h.in
@@ -17,4 +17,7 @@
/* XKB output dir for compiled keymaps. */
#undef XKM_OUTPUT_DIR
+/* Do not have `strcasecmp'. */
+#undef NEED_STRCASECMP
+
#endif /* _XKB_CONFIG_H_ */
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 6ab8e26eb..517b79d25 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -82,6 +82,12 @@
#define PR_DEBUG2(s,a,b)
#endif
+#ifdef NEED_STRCASECMP
+extern int _XkbStrCaseCmp(char *s1, char *s2);
+#else
+#define _XkbStrCaseCmp strcasecmp
+#endif
+
/***====================================================================***/
#define DFLT_LINE_SIZE 128
@@ -1106,13 +1112,13 @@ int len,headingtype,extra_ndx = 0;
for ( ; GetInputLine(file,&line,False); line.num_line= 0) {
if (line.line[0]=='!') {
tok = strtok(&(line.line[1]), " \t");
- if (strcmp(tolower(tok),"model") == 0)
+ if (_XkbStrCaseCmp(tolower(tok),"model") == 0)
headingtype = HEAD_MODEL;
- else if (strcmp(tolower(tok),"layout") == 0)
+ else if (_XkbStrCaseCmp(tok,"layout") == 0)
headingtype = HEAD_LAYOUT;
- else if (strcmp(tolower(tok),"variant") == 0)
+ else if (_XkbStrCaseCmp(tok,"variant") == 0)
headingtype = HEAD_VARIANT;
- else if (strcmp(tolower(tok),"option") == 0)
+ else if (_XkbStrCaseCmp(tok,"option") == 0)
headingtype = HEAD_OPTION;
else {
int i;
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index 01f6174aa..0ef485aa1 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -659,3 +659,19 @@ XkbNameMatchesPattern(char *name,char *ptrn)
/* if we get here, the pattern is exhausted (-:just like me:-) */
return (name[0]=='\0');
}
+
+#ifdef NEED_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