From: Ryan Bloom Date: Fri, 9 Jun 2000 21:19:52 +0000 (+0000) Subject: Remove a bunch of string functions from Apache. These are basically X-Git-Tag: APACHE_2_0_ALPHA_5~398 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b6800fd85c2685a3ec73bdf02f3161f72c8acd2;p=thirdparty%2Fapache%2Fhttpd.git Remove a bunch of string functions from Apache. These are basically standard string functions like strstr, strcasecmp, etc that Apache used to define for platforms that don't have them. These functions and the feature tests have moved down to APR where they really belong. In doing this, I am also able to remove a bunch of tests from the Apache configure process. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85487 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/configure.in b/configure.in index 0bcb5e7fc67..643b8034829 100644 --- a/configure.in +++ b/configure.in @@ -100,10 +100,6 @@ dnl ## Check for library functions dnl See Comment #Spoon AC_CHECK_FUNCS( \ -strdup \ -strcasecmp \ -strncasecmp \ -strstr \ initgroups \ waitpid \ memmove \ diff --git a/include/httpd.h b/include/httpd.h index 3831c3e2834..b06a4556ab9 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -969,14 +969,6 @@ API_EXPORT(char *) ap_pbase64encode(ap_pool_t *p, char *string); API_EXPORT(char *) ap_uudecode(ap_pool_t *p, const char *bufcoded); API_EXPORT(char *) ap_uuencode(ap_pool_t *p, char *string); -#ifndef HAVE_STRCASECMP -int strcasecmp(const char *a, const char *b); -#endif - -#ifndef HAVE_STRNCASECMP -int strncasecmp(const char *a, const char *b, size_t n); -#endif - #include "pcreposix.h" API_EXPORT(regex_t *) ap_pregcomp(ap_pool_t *p, const char *pattern, diff --git a/os/win32/os.h b/os/win32/os.h index d20914d32f1..a08ea5be0d1 100644 --- a/os/win32/os.h +++ b/os/win32/os.h @@ -116,13 +116,6 @@ typedef int mode_t; typedef char * caddr_t; #define HAVE_MEMMOVE -#define HAVE_STRCASECMP -#define HAVE_STRNCASECMP -#define HAVE_STRDUP -#define HAVE_STRSTR - -#define strcasecmp(s1, s2) stricmp(s1, s2) -#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) #define HAVE_SYS_STAT_H #define lstat(x, y) stat(x, y) diff --git a/server/util.c b/server/util.c index 5c7e834aa86..e6746d95e5b 100644 --- a/server/util.c +++ b/server/util.c @@ -1689,91 +1689,6 @@ API_EXPORT(int) ap_is_url(const char *u) return (x ? 1 : 0); /* If the first character is ':', it's broken, too */ } -#ifndef HAVE_STRDUP -char *strdup(const char *str) -{ - char *sdup; - - if (!(sdup = (char *) malloc(strlen(str) + 1))) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Ouch! Out of memory in our strdup()!"); - return NULL; - } - sdup = strcpy(sdup, str); - - return sdup; -} -#endif - -/* The following two routines were donated for SVR4 by Andreas Vogel */ -#ifndef HAVE_STRCASECMP -int strcasecmp(const char *a, const char *b) -{ - const char *p = a; - const char *q = b; - for (p = a, q = b; *p && *q; p++, q++) { - int diff = ap_tolower(*p) - ap_tolower(*q); - if (diff) - return diff; - } - if (*p) - return 1; /* p was longer than q */ - if (*q) - return -1; /* p was shorter than q */ - return 0; /* Exact match */ -} - -#endif - -#ifndef HAVE_STRNCASECMP -int strncasecmp(const char *a, const char *b, size_t n) -{ - const char *p = a; - const char *q = b; - - for (p = a, q = b; /*NOTHING */ ; p++, q++) { - int diff; - if (p == a + n) - return 0; /* Match up to n characters */ - if (!(*p && *q)) - return *p - *q; - diff = ap_tolower(*p) - ap_tolower(*q); - if (diff) - return diff; - } - /*NOTREACHED */ -} -#endif - -/* The following routine was donated for UTS21 by dwd@bell-labs.com */ -#ifndef HAVE_STRSTR -char *strstr(char *s1, char *s2) -{ - char *p1, *p2; - if (*s2 == '\0') { - /* an empty s2 */ - return(s1); - } - while((s1 = strchr(s1, *s2)) != NULL) { - /* found first character of s2, see if the rest matches */ - p1 = s1; - p2 = s2; - while (*++p1 == *++p2) { - if (*p1 == '\0') { - /* both strings ended together */ - return(s1); - } - } - if (*p2 == '\0') { - /* second string ended, a match */ - break; - } - /* didn't find a match here, try starting at next character in s1 */ - s1++; - } - return(s1); -} -#endif - #ifndef HAVE_INITGROUPS int initgroups(const char *name, gid_t basegid) {