summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--utils.c68
-rw-r--r--utils.h19
3 files changed, 4 insertions, 85 deletions
diff --git a/configure.ac b/configure.ac
index 7a73509..430046c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ if test ! -f "$srcdir/xkbparse.c"; then
fi
fi
-AC_CHECK_FUNCS([asprintf reallocarray recallocarray strdup strcasecmp])
+AC_CHECK_FUNCS([asprintf reallocarray recallocarray])
# Checks for pkg-config packages
PKG_CHECK_MODULES(XKBCOMP, [x11 xkbfile xproto >= 7.0.17])
diff --git a/utils.c b/utils.c
index deb96ea..2dcb994 100644
--- a/utils.c
+++ b/utils.c
@@ -262,71 +262,3 @@ uFinishUp(void)
fprintf(errorFile, "%s\n", postMsg);
return;
}
-
-/***====================================================================***/
-
-#ifndef HAVE_STRDUP
-char *
-uStringDup(const char *str)
-{
- char *rtrn;
-
- if (str == NULL)
- return NULL;
- rtrn = malloc(strlen(str) + 1);
- strcpy(rtrn, str);
- return rtrn;
-}
-#endif
-
-#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, const 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
diff --git a/utils.h b/utils.h
index 2bf7674..a3b83b0 100644
--- a/utils.h
+++ b/utils.h
@@ -134,6 +134,9 @@ uInformation(const char * /* s */ , ...
/***====================================================================***/
+#include <strings.h>
+#include <string.h>
+
#define NullString ((char *)NULL)
#define uStringText(s) ((s)==NullString?"<NullString>":(s))
@@ -142,25 +145,9 @@ uInformation(const char * /* s */ , ...
#define uStringCompare(s1,s2) (((s1)==NullString||(s2)==NullString)?\
(s1)!=(s2):strcmp(s1,s2))
#define uStrCaseEqual(s1,s2) (uStrCaseCmp(s1,s2)==0)
-#ifdef HAVE_STRCASECMP
-#include <strings.h>
#define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
-#else
- extern int uStrCaseCmp(const char * /* s1 */ ,
- const char * /* s2 */
- );
- extern int uStrCasePrefix(const char * /* p */ ,
- char * /* str */
- );
-#endif
-#ifdef HAVE_STRDUP
-#include <string.h>
#define uStringDup(s1) ((s1) ? strdup(s1) : NULL)
-#else
- extern char *uStringDup(const char * /* s1 */
- );
-#endif
/***====================================================================***/