aboutsummaryrefslogtreecommitdiff
path: root/lib/strequal.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-09-15 00:32:08 +0000
committerYang Tse <yangsita@gmail.com>2008-09-15 00:32:08 +0000
commit4c621bc697b13472eeb90202f42b2a183b629e42 (patch)
tree7d87381c798bde41737ea9e6065e2a1751d11f19 /lib/strequal.c
parent938458b330370fc4321051524637334da62476a8 (diff)
improve detection of:
strcasecmp() strcasestr() strcmpi() stricmp() strlcat() strncasecmp() strncmpi() strnicmp()
Diffstat (limited to 'lib/strequal.c')
-rw-r--r--lib/strequal.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/strequal.c b/lib/strequal.c
index 639a7ffc2..ac9075d58 100644
--- a/lib/strequal.c
+++ b/lib/strequal.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -21,11 +21,6 @@
* $Id$
***************************************************************************/
-#ifndef _GNU_SOURCE
-/* glibc needs this to define the prototype for strcasestr */
-#define _GNU_SOURCE 1
-#endif
-
#include "setup.h"
#include <string.h>
@@ -37,12 +32,6 @@
#include "strequal.h"
-#if defined(HAVE_STRCASECMP) && defined(__STRICT_ANSI__)
-/* this is for "-ansi -Wall -pedantic" to stop complaining! */
-extern int (strcasecmp)(const char *s1, const char *s2);
-extern int (strncasecmp)(const char *s1, const char *s2, size_t n);
-#endif
-
int curl_strequal(const char *first, const char *second)
{
#if defined(HAVE_STRCASECMP)
@@ -65,11 +54,11 @@ int curl_strequal(const char *first, const char *second)
int curl_strnequal(const char *first, const char *second, size_t max)
{
-#if defined(HAVE_STRCASECMP)
+#if defined(HAVE_STRNCASECMP)
return !strncasecmp(first, second, max);
-#elif defined(HAVE_STRCMPI)
+#elif defined(HAVE_STRNCMPI)
return !strncmpi(first, second, max);
-#elif defined(HAVE_STRICMP)
+#elif defined(HAVE_STRNICMP)
return !strnicmp(first, second, max);
#else
while(*first && *second && max) {