Index: configure.ac =================================================================== RCS file: /cvs/xorg/lib/xkbfile/configure.ac,v retrieving revision 1.7 diff -u -r1.7 configure.ac --- configure.ac 21 Dec 2005 02:30:06 -0000 1.7 +++ configure.ac 20 Mar 2006 19:27:04 -0000 @@ -1,4 +1,4 @@ - + dnl Copyright 2005 Red Hat, Inc. dnl dnl Permission to use, copy, modify, distribute, and sell this software and its @@ -33,6 +33,10 @@ AC_PROG_CC AC_PROG_LIBTOOL +# Check for functions +AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP],1, + [Define to 1 if you do not have the `strcasecmp' function.])) + # Check for dependencies PKG_CHECK_MODULES(XKBFILE, x11 kbproto) Index: src/xkbmisc.c =================================================================== RCS file: /cvs/xorg/lib/xkbfile/src/xkbmisc.c,v retrieving revision 1.5 diff -u -r1.5 xkbmisc.c --- src/xkbmisc.c 3 Jul 2005 07:37:33 -0000 1.5 +++ src/xkbmisc.c 20 Mar 2006 19:27:06 -0000 @@ -150,31 +150,22 @@ /***===================================================================***/ +#ifdef NEED_STRCASECMP int _XkbStrCaseCmp(char *str1,char *str2) { - char buf1[512],buf2[512]; - char c, *s; - register 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)); -} + 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)); +} +#else +#define _XkbStrCaseCmp strcasecmp +#endif /***===================================================================***/