summaryrefslogtreecommitdiff
path: root/lgl
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-05-16 11:40:09 +0200
committerSimon Josefsson <simon@josefsson.org>2008-05-16 11:40:09 +0200
commita0f55f2bd0f5283b9a8df3a8ac77feed175d9e96 (patch)
tree9380ed8887e02e6760a20bd759f450547f384f88 /lgl
parent7a9fc785ad6d6a477bc35d6fe0f0d4838a38b3b5 (diff)
downloadgnutls-a0f55f2bd0f5283b9a8df3a8ac77feed175d9e96.tar.gz
Update gnulib files.
Diffstat (limited to 'lgl')
-rw-r--r--lgl/m4/memmem.m426
-rw-r--r--lgl/str-two-way.h4
2 files changed, 25 insertions, 5 deletions
diff --git a/lgl/m4/memmem.m4 b/lgl/m4/memmem.m4
index 383ed4b302..d8c1230970 100644
--- a/lgl/m4/memmem.m4
+++ b/lgl/m4/memmem.m4
@@ -1,4 +1,4 @@
-# memmem.m4 serial 10
+# memmem.m4 serial 12
dnl Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -49,9 +49,27 @@ AC_DEFUN([gl_FUNC_MEMMEM],
/* Check for empty needle behavior. */
return !result || !memmem ("a", 1, 0, 0);]])],
[gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
- [dnl pessimistically assume the worst, since even glibc 2.6.1
- dnl has quadratic complexity in its memmem
- gl_cv_func_memmem_works="guessing no"])])
+ [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
+ dnl memmem that works in linear time.
+ AC_EGREP_CPP([Lucky user],
+ [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
+ Lucky user
+ #endif
+#endif
+#ifdef __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_MAJOR >= 1007
+ Lucky user
+ #endif
+#endif
+ ],
+ [gl_cv_func_memmem_works=yes],
+ [gl_cv_func_memmem_works="guessing no"])
+ ])
+ ])
if test "$gl_cv_func_memmem_works" != yes; then
REPLACE_MEMMEM=1
AC_LIBOBJ([memmem])
diff --git a/lgl/str-two-way.h b/lgl/str-two-way.h
index 846824506c..69580736fa 100644
--- a/lgl/str-two-way.h
+++ b/lgl/str-two-way.h
@@ -67,7 +67,9 @@
# define LONG_NEEDLE_THRESHOLD SIZE_MAX
#endif
-#define MAX(a, b) ((a < b) ? (b) : (a))
+#ifndef MAX
+# define MAX(a, b) ((a < b) ? (b) : (a))
+#endif
#ifndef CANON_ELEMENT
# define CANON_ELEMENT(c) c