(!1792) os: drop own implementation of strcasecmp() and strncasecmp()
These are POSIX standard since 2001, so shouldn't be needed anymore. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
a85800ab9a
commit
ada50facb2
|
@ -169,11 +169,9 @@ conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction') ? '1' : false)
|
||||||
conf_data.set('HAVE_SIGPROCMASK', cc.has_function('sigprocmask') ? '1' : false)
|
conf_data.set('HAVE_SIGPROCMASK', cc.has_function('sigprocmask') ? '1' : false)
|
||||||
# HAVE_SOCKLEN_T is used by xtrans when IPv6 is disabled
|
# HAVE_SOCKLEN_T is used by xtrans when IPv6 is disabled
|
||||||
conf_data.set('HAVE_SOCKLEN_T', cc.has_type('socklen_t', prefix: '#include <sys/socket.h>') ? '1' : false)
|
conf_data.set('HAVE_SOCKLEN_T', cc.has_type('socklen_t', prefix: '#include <sys/socket.h>') ? '1' : false)
|
||||||
conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp') ? '1' : false)
|
|
||||||
conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr') ? '1' : false)
|
conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr') ? '1' : false)
|
||||||
conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep) ? '1' : false)
|
conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep) ? '1' : false)
|
||||||
conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: libbsd_dep) ? '1' : false)
|
conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: libbsd_dep) ? '1' : false)
|
||||||
conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp') ? '1' : false)
|
|
||||||
conf_data.set('HAVE_STRNDUP', cc.has_function('strndup') and cc.has_header_symbol('string.h', 'strndup') ? '1' : false)
|
conf_data.set('HAVE_STRNDUP', cc.has_function('strndup') and cc.has_header_symbol('string.h', 'strndup') ? '1' : false)
|
||||||
# HAVE_STRUCT_SOCKADDR_STORAGE is used by xtrans >= 1.6
|
# HAVE_STRUCT_SOCKADDR_STORAGE is used by xtrans >= 1.6
|
||||||
conf_data.set('HAVE_STRUCT_SOCKADDR_STORAGE', cc.has_type('struct sockaddr_storage', prefix: '#include <sys/socket.h>') ? '1' : false)
|
conf_data.set('HAVE_STRUCT_SOCKADDR_STORAGE', cc.has_type('struct sockaddr_storage', prefix: '#include <sys/socket.h>') ? '1' : false)
|
||||||
|
|
12
include/os.h
12
include/os.h
|
@ -234,18 +234,6 @@ extern _X_EXPORT void *
|
||||||
reallocarray(void *optr, size_t nmemb, size_t size);
|
reallocarray(void *optr, size_t nmemb, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRCASECMP
|
|
||||||
#define strcasecmp xstrcasecmp
|
|
||||||
extern _X_EXPORT int
|
|
||||||
xstrcasecmp(const char *s1, const char *s2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
|
||||||
#define strncasecmp xstrncasecmp
|
|
||||||
extern _X_EXPORT int
|
|
||||||
xstrncasecmp(const char *s1, const char *s2, size_t n);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRCASESTR
|
#ifndef HAVE_STRCASESTR
|
||||||
#define strcasestr xstrcasestr
|
#define strcasestr xstrcasestr
|
||||||
extern _X_EXPORT char *
|
extern _X_EXPORT char *
|
||||||
|
|
|
@ -38,9 +38,6 @@
|
||||||
/* Define to 1 if you have the `reallocarray' function. */
|
/* Define to 1 if you have the `reallocarray' function. */
|
||||||
#mesondefine HAVE_REALLOCARRAY
|
#mesondefine HAVE_REALLOCARRAY
|
||||||
|
|
||||||
/* Define to 1 if you have the `strcasecmp' function. */
|
|
||||||
#mesondefine HAVE_STRCASECMP
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strcasestr' function. */
|
/* Define to 1 if you have the `strcasestr' function. */
|
||||||
#mesondefine HAVE_STRCASESTR
|
#mesondefine HAVE_STRCASESTR
|
||||||
|
|
||||||
|
@ -50,9 +47,6 @@
|
||||||
/* Define to 1 if you have the `strlcpy' function. */
|
/* Define to 1 if you have the `strlcpy' function. */
|
||||||
#mesondefine HAVE_STRLCPY
|
#mesondefine HAVE_STRLCPY
|
||||||
|
|
||||||
/* Define to 1 if you have the `strncasecmp' function. */
|
|
||||||
#mesondefine HAVE_STRNCASECMP
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strndup' function. */
|
/* Define to 1 if you have the `strndup' function. */
|
||||||
#mesondefine HAVE_STRNDUP
|
#mesondefine HAVE_STRNDUP
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,6 @@ srcs_libc = []
|
||||||
if conf_data.get('HAVE_REALLOCARRAY').to_int() == 0
|
if conf_data.get('HAVE_REALLOCARRAY').to_int() == 0
|
||||||
srcs_libc += 'reallocarray.c'
|
srcs_libc += 'reallocarray.c'
|
||||||
endif
|
endif
|
||||||
if conf_data.get('HAVE_STRCASECMP').to_int() == 0
|
|
||||||
srcs_libc += 'strcasecmp.c'
|
|
||||||
endif
|
|
||||||
if conf_data.get('HAVE_STRCASESTR').to_int() == 0
|
if conf_data.get('HAVE_STRCASESTR').to_int() == 0
|
||||||
srcs_libc += 'strcasestr.c'
|
srcs_libc += 'strcasestr.c'
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -31,38 +31,3 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "dix.h"
|
#include "dix.h"
|
||||||
|
|
||||||
#ifndef HAVE_STRCASECMP
|
|
||||||
int
|
|
||||||
xstrcasecmp(const char *str1, const 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
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
|
||||||
int
|
|
||||||
xstrncasecmp(const char *s1, const char *s2, size_t n)
|
|
||||||
{
|
|
||||||
if (n != 0) {
|
|
||||||
const u_char *us1 = (const u_char *) s1, *us2 = (const u_char *) s2;
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (tolower(*us1) != tolower(*us2++))
|
|
||||||
return (tolower(*us1) - tolower(*--us2));
|
|
||||||
if (*us1++ == '\0')
|
|
||||||
break;
|
|
||||||
} while (--n != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue