>From c96bccbbaa28b6888e487ff86c8b43bd594d2de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Wed, 23 Jun 2010 00:42:54 +0100 Subject: [PATCH] memmem: rearrange memmem and expand memmem-simple modules Move all functional checks to memmem-simple so that one has a fully functional memmem by using just this module. Restrict the memmem module to performance checks only. Document exactly how the memmem and memmem-simple modules relate to each other. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Move the empty needle check from the memmem module to memmem-simple. Also expand the empty needle check to ensure the correct pointer is returned, not just a non NULL pointer. In gl_FUNC_MEMMEM, make the cross compilation check only consider the versions with performance issues. * doc/glibc-functions/memmem.texi: Rearrange the portability documentation to correlate with the rearranged checks. --- ChangeLog | 14 +++++++++++++ doc/glibc-functions/memmem.texi | 12 ++++++++-- m4/memmem.m4 | 42 +++++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a65773..4d83a57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,18 @@ 2010-12-15 Pádraig Brady + + memmem, memmem-simple: reorganize and expand empty needle check + * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Move all + functional checks to memmem-simple so that one has a fully functional + memmem by using just this module. + Restrict the performance only check to the memmem module. + Also expand the empty needle check to ensure the correct + pointer is returned, not just a non NULL pointer. + * doc/glibc-functions/memmem.texi: Rearrange the portability + documentation to correlate with the rearranged checks. + Clarify exactly how the memmem and memmem-simple modules + relate to each other. + +2010-12-15 Pádraig Brady Bruno Haible Improve cross-compilation guesses for uClibc. diff --git a/doc/glibc-functions/memmem.texi b/doc/glibc-functions/memmem.texi index 60cb174..8911756 100644 --- a/doc/glibc-functions/memmem.texi +++ b/doc/glibc-functions/memmem.texi @@ -4,6 +4,10 @@ Gnulib module: memmem or memmem-simple +Both modules implement the same replacement for the @code{memmem} function +with the memmem module providing a replacement on more platforms where +the existing @code{memmem} function has a quadratic worst-case complexity. + Portability problems fixed by either Gnulib module @code{memmem-simple} or @code{memmem}: @itemize @@ -17,18 +21,20 @@ Linux libc 5.0.9 This function can trigger false positives for long periodic needles on some platforms: glibc 2.12, Cygwin 1.7.7. address@hidden itemize -Portability problems fixed by Gnulib module @code{memmem}: address@hidden @item This function returns incorrect values in some cases, such as when given an empty needle: glibc <= 2.0, Cygwin 1.5.x. address@hidden itemize + +Performance problems fixed by Gnulib module @code{memmem}: address@hidden @item This function has quadratic instead of linear worst-case complexity on some platforms: glibc 2.8, FreeBSD 6.2, NetBSD 5.0, AIX 5.1, Solaris 11 2010-11, Cygwin 1.5.x. +Note for small needles the replacement may be slower. @end itemize Portability problems not fixed by Gnulib: diff --git a/m4/memmem.m4 b/m4/memmem.m4 index e3bb83b..0ad18e1 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -5,7 +5,7 @@ dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -dnl Check that memmem is present. +dnl Check that memmem is present and functional. AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], [ dnl Persuade glibc