Eric Blake [Sat, 5 Jan 2008 21:09:11 +0000 (14:09 -0700)]
Rewrite memmem to guarantee linear complexity without malloc.
* lib/memmem.c (memmem): Use Two-Way rather than
Knuth-Morris-Pratt, to allow O(1) space usage.
(critical_factorization, two_way_short_needle)
(two_way_long_needle): New functions.
(knuth_morris_pratt): Delete.
* modules/memmem (Depends-on): No longer need malloca or stdbool.
Add stdint.
* tests/test-memmem.c (main): Add tests for periodic needle and
sublinear performance.
* doc/functions/memmem.texi (memmem): Document other deficiencies
in cygwin and older glibc.
Eric Blake [Sat, 5 Jan 2008 11:47:05 +0000 (04:47 -0700)]
Fix memmem test for mingw.
* modules/memmem-tests (configure.ac): Check for alarm.
* tests/test-memmem.c (main): Avoid alarm on platforms that lack
it.
* doc/functions/memmem.texi: New file.
* doc/gnulib.texi (Function Substitutes): Add memmem.
Reported by Bruno Haible.
Eric Blake [Wed, 19 Dec 2007 23:09:03 +0000 (16:09 -0700)]
Fix memmem to avoid O(n^2) worst-case complexity.
* lib/memmem.c (knuth_morris_pratt): New function.
(memmem): Use it if first few naive iterations fail.
* m4/memmem.m4 (gl_FUNC_MEMMEM): Detect cygwin bug.
* modules/memcmp (License): Set to LGPLv2+, not LGPL.
* modules/memchr (License): Likewise.
* modules/memmem (Depends-on): Add memcmp, memchr, stdbool, and
malloca.
* tests/test-memmem.c: Rewrite, borrowing ideas from
test-mbsstr1.c; the old version wouldn't even compile!
* modules/memmem-tests: New file.
* lib/string.in.h (rpl_memmem): Add declaration.
* modules/string (Makefile.am): Substitute REPLACE_MEMMEM.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Default for
REPLACE_MEMMEM.
Paul Eggert [Wed, 19 Dec 2007 00:11:25 +0000 (16:11 -0800)]
Fix problem with _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H on VMS.
* lib/stdint.in.h (_GL_JUST_INCLUDE_SYSTEM_INTTYPES_H): Define
before any system include files, and undef after them all. This
should fix a problem on VMS reported by John E. Malmberg in
<http://lists.gnu.org/archive/html/bug-gnulib/2007-12/msg00118.html>.
Eric Blake [Tue, 18 Dec 2007 04:50:40 +0000 (21:50 -0700)]
Revert addition of verify, for BSD/OS.
* lib/fseeko.c [!HAVE_FSEEKO]: Allow off_t > long, even though it
can't handle large files, for the sake of obsolete platforms.
* modules/fseeko (Depends-on): Remove verify.
* doc/functions/fseeko.texi (fseeko): Document BSD/OS limitation.
* doc/functions/ftello.texi (ftello): Likewise.
* doc/functions/fgetpos.texi (fgetpos): Likewise.
Reported by Larry Jones.
Jim Meyering [Fri, 14 Dec 2007 18:46:26 +0000 (19:46 +0100)]
Port to GNU/kFreeBSD - FreeBSD kernel + GNU libc,
which has no openat syscall, yet <fcntl.h> does define AT_FDCWD.
* lib/getcwd.c: Undef AT_FDCWD if there is no openat function.
* modules/getcwd (Depends-on): Add openat.
Reported by Petr Salinger.
Eric Blake [Thu, 13 Dec 2007 21:58:44 +0000 (14:58 -0700)]
Another fseek test.
* tests/test-fseek.c (main): Also test ungetc handling.
* tests/test-fseeko.c (main): Likewise.
* modules/fseeko (Depends-on): Add verify.
* lib/fseeko.c [!HAVE_FSEEKO]: Verify that off_t is not too
large.
Reported by Larry Jones.
Eric Blake [Tue, 11 Dec 2007 21:00:26 +0000 (14:00 -0700)]
Fix bug with -0.0L in previous patch.
* lib/isnan.c (rpl_isnanl): Make robust to -0.0L and pad bits.
* tests/test-isnan.c (main): Also test on zeroes.
* tests/test-isnanf.c (main): Likewise.
* tests/test-isnanl.h (main): Likewise.
Eric Blake [Tue, 11 Dec 2007 18:35:55 +0000 (11:35 -0700)]
Detect pseudo-denormals on x86 even when cross-compiling.
* lib/isnan.c (rpl_isnanl) [!KNOWN_EXPBIT0_LOCATION
&& USE_LONG_DOUBLE && x86]: Add one more check to filter out
invalid bit patterns that happen to satisfy ==.
Jim Meyering [Fri, 7 Dec 2007 15:20:57 +0000 (16:20 +0100)]
Let these macros work also with autoconf-2.59.
* m4/getline.m4 (gl_FUNC_GETLINE): Require only autoconf-2.59. 2.60
is not needed, since gnulib now permits use of AC_CHECK_DECLS_ONCE.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise.
Eric Blake [Tue, 4 Dec 2007 15:38:22 +0000 (08:38 -0700)]
Make cygwin fseeko check more reliable.
* m4/stdio_h.m4 (gl_STDIN_LARGE_OFFSET) [__CYGWIN__]: Use cygwin
version numbers, rather than unrelated feature check.
* doc/functions/fseeko.texi (fseeko): Tweak failure report.
* doc/functions/ftello.texi (ftello): Likewise.
Reported by Bruno Haible.
Paul Eggert [Mon, 3 Dec 2007 23:30:36 +0000 (15:30 -0800)]
Add support for Solaris 10 ACLs. Also, ACLs are Gnulib, not Autoconf.
* modules/acl (configure.ac): Rename AC_FUNC_ACL to gl_FUNC_ACL.
* m4/acl.m4 (gl_FUNC_ACL): Renamed from AC_FUNC_ACL. On Solaris,
put -lsec in even for programs other than 'ls'. This fixes a problem
for gettext reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-gnulib/2007-12/msg00007.html>.
* lib/acl.c (copy_acl, qset_acl) [USE_ACL && defined ACL_NO_TRIVIAL]:
Add support for Solaris 10. This isn't efficient, but should get the
job done for now.
Jim Meyering [Sat, 1 Dec 2007 14:34:41 +0000 (15:34 +0100)]
Fix a 4-year-old used-uninitialized bug in regcomp.c.
* lib/regcomp.c (optimize_utf8): Fix a typo, s/idx/ctx_type/,
that would inhibit utf8-optimization of a regexp containing line-
or buffer-anchors, e.g., `^', `$'.