Here is a starting point for a new memmem-simple module. What do you think?
/Simon modules/memmem-simple: Description: memmem() function: locate first substring in a buffer. Files: lib/memmem.c m4/memmem.m4 Depends-on: extensions string stdint memchr memcmp configure.ac: gl_FUNC_MEMMEM_SIMPLE gl_STRING_MODULE_INDICATOR([memmem]) Makefile.am: Include: <string.h> License: LGPLv2+ Maintainer: libc, Eric Blake diff --git a/m4/memmem.m4 b/m4/memmem.m4 index 9767354..10d6f5a 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 7 +# memmem.m4 serial 8 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, @@ -14,7 +14,7 @@ AC_DEFUN([gl_FUNC_MEMMEM], AC_CHECK_DECLS_ONCE(memmem) if test $ac_cv_have_decl_memmem = no; then HAVE_DECL_MEMMEM=0 - else + else if "$gl_cv_memmem_simple" != "yes"; then AC_CACHE_CHECK([whether memmem works in linear time], [gl_cv_func_memmem_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([ @@ -49,5 +49,11 @@ AC_DEFUN([gl_FUNC_MEMMEM], gl_PREREQ_MEMMEM ]) +AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], +[ + gl_cv_memmem_simple=yes + gl_FUNC_MEMMEM +]) + # Prerequisites of lib/memmem.c. AC_DEFUN([gl_PREREQ_MEMMEM], [:]) diff --git a/modules/memmem b/modules/memmem index 71f770f..28e386d 100644 --- a/modules/memmem +++ b/modules/memmem @@ -1,5 +1,5 @@ Description: -memmem() function: locate first substring in a buffer. +memmem() function: efficiently locate first substring in a buffer. Files: lib/memmem.c