summaryrefslogtreecommitdiff
path: root/lib/regex_internal.h
Commit message (Collapse)AuthorAgeFilesLines
* assume <ctype.h>, ..., <time.h> existPaul Eggert2011-01-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | For years gnulib has been assuming the existence of the headers <ctime.h>, <errno.h>, <fcntl.h>, <locale.h>, <signal.h>, <stdio.h>, <stdlib.h>, <string.h>, and <time.h>. Omit checks for them, since they don't appear to be needed. * README (Portability guidelines): Document this. * lib/flock.c: Assume <fcntl.h> exists. * lib/regex_internal.h: Assume <locale.h> exists. * m4/ctype.m4 (gl_CTYPE_H): Assume <ctype.h> exists. * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Assume <errno.h> exists. * m4/fcntl_h.m4 (gl_FCNTL_H): Assume <fcntl.h> exists. * m4/flock.m4 (gl_PREREQ_FLOCK): Likewise. * m4/locale_h.m4 (gl_LOCALE_H): Assume <locale.h> exists. * m4/regex.m4 (gl_REGEX): Likewise. * m4/signal_h.m4 (gl_SIGNAL_H): Assume <signal.h> exists. * m4/stdio_h.m4 (gl_STDIO_H): Assume <stdio.h> exists. * m4/stdlib_h.m4 (gl_STDLIB_H): Assume <stdlib.h> exists. * m4/string_h.m4 (gl_STRING_H): Assume <string.h> exists. * tests/test-argp.c: Likewise. * m4/time_h.m4 (gl_HEADER_TIME_H_BODY): Assume <time.h> exists.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-2/+1
| | | | Run the new "make update-copyright" rule.
* regex: Don't require alloca.Bruno Haible2010-05-241-0/+2
|
* regex: fix build failureEric Blake2010-01-281-0/+9
| | | | | | | * lib/regex_internal.h (__GNUC_PREREQ): Define for non-glibc platforms. Signed-off-by: Eric Blake <ebb9@byu.net>
* regex_internal.h: define __attribute_warn_unused_result__Jim Meyering2010-01-281-0/+8
| | | | * lib/regex_internal.h (__attribute_warn_unused_result__): Define.
* regcomp: sync from glibc; always use nl_langinfoJim Meyering2010-01-041-3/+2
| | | | | | | * lib/regcomp.c (init_dfa) [!LIBC]: Always use nl_langinfo (CODESET), now that gnulib provides it. Recognize UTF8 as well as UTF-8. * lib/regex_internal.h: Always include <langinfo.h>, now. * modules/regex (Depends-on): Add nl_langinfo.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-2/+2
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* regex: avoid compilation failure with upcoming gcc-4.4Jim Meyering2009-02-071-4/+0
| | | | | | * lib/regex_internal.h: Revert e48d8b47fb3eee81d341b71c3e006efe9e3433a7 [workaround for PGC prior to 6.1-2]. Otherwise, we'd get this: "... error: integer overflow in preprocessor expression".
* regex: replace mbrtowc with __mbrtowc.Paolo Bonzini2009-01-091-1/+3
| | | | | | | | | 2009-01-09 Paolo Bonzini <bonzini@gnu.org> * lib/regcomp.c (re_compile_fastmap_iter): Use __mbrtowc. * lib/regex_internal.c (build_wcs_buffer, build_wcs_upper_buffer, re_string_skip_chars, re_string_reconstruct): Likewise. * lib/regex_internal.h [!_LIBC] (__mbrtowc): New #define.
* update regex to use the emulated mb*/wc* functionsPaolo Bonzini2008-12-221-1/+1
| | | | | | * modules/regex: Request emulations for the mb*/wc* functions we need. * m4/regex.m4: Don't look for those functions here. * lib/regex_internal.h: Do not check HAVE_WCRTOMB and HAVE_MBRTOWC.
* Make determination of BITSET_WORD_MAX work also with old HP-UX cc compilers.Bruno Haible2008-07-311-2/+2
|
* Avoid compile failure on OS/2.Eric Blake2008-04-111-2/+2
| | | | | | | | * lib/regex_internal.h (internal_function): Disable optimization on OS/2 (__EMX__), where it caused compiler error. Reported by Elbert Pol. Signed-off-by: Eric Blake <ebb9@byu.net>
* Work around problem reported by Steven M. Schweda inPaul Eggert2007-06-061-1/+1
| | | | | | | | | | <http://lists.gnu.org/archive/html/bug-tar/2007-06/msg00002.html>: Tru64 5.1B with the Compaq compiler environment installed declares an 'isblank' function but does not define it in the C library. * lib/fnmatch.c (isblank): Check for HAVE_ISBLANK, too. * lib/regex_internal.h (isblank): Likewise. * m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Check for isblank existence. * m4/regex.m4 (gl_PREREQ_REGEX): Likewise.
* Fix regex code so it doesn't rely on strcasecmp.Paul Eggert2007-02-151-1/+3
| | | | | | | | | | * lib/regex_internal.h: Include <langinfo.h> only if _LIBC is defined. Otherwise, include gnulib's langinfo.h. * lib/regcomp.c (init_dfa): Don't use strcasecmp, as it can have undesirable behavior in non-C locales. Instead, rely on locale_charset. * m4/regex.m4 (gl_PREREQ_REGEX): Don't require AM_LANGINFO_CODESET. * modules/regex (FILES): Remove m4/codeset.m4. (Depends-on): Add localcharset. Remove strcase.
* Avoid mempcpy in the regex code, as the string.h mempcpy stuffPaul Eggert2007-02-021-4/+0
| | | | | | | | is causing more trouble than it's curing. * lib/regex_internal.h (__mempcpy): Remove. * lib/regcomp.c (regerror): Rewrite to avoid the need for mempcpy (and make the code a tad smaller to boot). * m4/regex.m4 (gl_PREREQ_REGEX): Don't check for mempcpy.
* * modules/regex (Depends-on): Revert dependence on mempcpy.Eric Blake2007-02-011-0/+1
| | | | | | * lib/regex_internal.h [! _LIBC && !__mempcpy]: Undo string module's definition of mempcpy. Reported by Paul Eggert.
* * doc/gnulib-tool.texi (Initial import): Update to match currentPaul Eggert2007-01-261-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior with strdup module. * lib/.cppi-disable: Remove strcase.h, strdup.h, strndup.h, strnlen.h. * lib/memmem.h: Remove; all uses removed. This is now done by <string.h>. * lib/mempcpy.h: Likewise. * lib/memrchr.h: Likewise. * lib/stpcpy.h: Likewise. * lib/stpncpy.h: Likewise. * lib/strcase.h: Likewise. * lib/strchrnul.h: Likewise. * lib/strdup.h: Likewise. * lib/strndup.h: Likewise. * lib/strnlen.h: Likewise. * lib/strpbrk.h: Likewise. * lib/strsep.h: Likewise. * lib/strstr.h: Likewise. * lib/strtok_r.h: Likewise. * lib/string_.h: New file. * lib/argp-namefrob.h: Don't include no-longer-existent include files. Rely on <string.h> instead. * lib/canon-host.c: Likewise. * lib/chdir-long.c: Likewise. * lib/concatpath.c: Likewise. * lib/exclude.c: Likewise. * lib/fchdir.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getcwd.c: Likewise. * lib/getsubopt.c: Likewise. * lib/glob.c: Likewise. * lib/hard-locale.c: Likewise. * lib/iconvme.c: Likewise. * lib/javacomp.c: Likewise. * lib/mempcpy.c: Likewise. * lib/memrchr.c: Likewise. * lib/regex_internal.h: Likewise. * lib/stpncpy.c: Likewise. * lib/strcasecmp.c: Likewise. * lib/strchrnul.c: Likewise. * lib/strdup.c: Likewise. * lib/striconv.c: Likewise. * lib/striconveh.c: Likewise. * lib/striconveha.c: Likewise. * lib/strncasecmp.c: Likewise. * lib/strndup.c: Likewise. * lib/strnlen.c: Likewise. * lib/strsep.c: Likewise. * lib/strstr.c: Likewise. * lib/strtok_r.c: Likewise. * lib/userspec.c: Likewise. * lib/w32spawn.h: Likewise. * lib/xstrndup.c: Likewise. * lib/mountlist.c (strstr): Remove decl. * m4/string_h.m4: New file. * m4/memmem.m4 (gl_FUNC_MEMMEM): Set HAVE_DECL_MEMMEM if necessary. * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): Set HAVE_MEMPCPY if necessary. * m4/memrchr.m4 (gl_FUNC_MEMRCHR): Set HAVE_MEMRCHR * m4/stpcpy.m4 (gl_FUNC_STPCPY): Set HAVE_STPCPY if necessary. * m4/stpncpy.m4 (gl_PREREQ_STPNCPY): Set HAVE_STPNCPY if necessary. * m4/strcase.m4 (gl_FUNC_STRCASECMP): Set REPLACE_STRCASECMP if necessary. (gl_FUNC_STRNCASECMP): Set HAVE_DECL_STRNCASECMP if necessary. * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Set HAVE_STRCHRNUL if necessary. * m4/strdup.m4 (gl_FUNC_STRDUP): Set HAVE_DECL_STRDUP if necessary. * m4/strndup.m4 (gl_FUNC_STRNDUP): Set HAVE_DECL_STRNLEN and HAVE_DECL_STRDUP if necessary. (gl_PREREQ_STRNLEN): Don't bother to check for strnlen decl, since gl_FUNC_STRNDUP does that now. * m4/strnlen.m4 (gl_FUNC_STRNLEN): Set HAVE_DECL_STRNLEN if necessary. Check for decl here... (gl_PREREQ_STRNLEN): ... not here. * m4/strpbrk.m4 (gl_FUNC_STRPBRK): Set HAVE_STRPBRK if necessary. * m4/strsep.m4 (gl_FUNC_STRSEP): Set HAVE_STRSEP if necessary. * m4/strstr.m4 (gl_FUNC_STRSTR): Set REPLACE_STRSTR if necessary. * m4/strtok_r.m4 (gl_FUNC_STRTOK_R): Set HAVE_DECL_STRTOK_R if necessary. * modules/string: New file. * modules/memmem (Files): Remove special-purpose include file. (Depends-on): Add string. (Include): Include <string.h>, not the removed file. * modules/mempcpy: Likewise. * modules/memrchr: Likewise. * modules/stpcpy: Likewise. * modules/stpncpy: Likewise. * modules/strcase: Likewise. * modules/strchrnul: Likewise. * modules/strdup: Likewise. * modules/strndup: Likewise. * modules/strnlen: Likewise. * modules/strpbrk: Likewise. * modules/strsep: Likewise. * modules/strstr: Likewise. * modules/strtok_r: Likewise. * tests/test-dirname.c: Don't include "stdup.h", since <string.h> now suffices. * tests/test-memmem.c: Don't include "memmem.h", since <string.h> now suffices.
* * modules/fnmatch (Depends-on): Depend on wchar.Eric Blake2007-01-161-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/fnmatch.c (WIDE_CHAR_SUPPORT): Assume <wchar.h>. * m4/fnmatch.m4: Likewise. * modules/mbchar (Makefile.am): Assume <wchar.h>. * m4/mbchar.m4: Likewise. * modules/mbswidth (Depends-on): Depend on wchar. * lib/mbswidth.c: Assume <wchar.h>. * m4/mbswidth.m4: Likewise. * modules/quotearg (Depends-on): Depend on wchar. * lib/quotearg.c: Assume <wchar.h>. * m4/quotearg.m4: Likewise. * modules/regex (Depends-on): Depend on wchar. * lib/regex_internal.h: Assume <wchar.h>. * m4/regex.m4: Likewise. * modules/stdint (Depends-on): Depend on wchar. * lib/stdint_.h [!defined WCHAR_MIN]: Assume <wchar.h>. * m4/stdint.m4: Likewise. * tests/test-stdint.c [HAVE_WINT_T]: Likewise. * modules/strftime (Depends-on): Depend on wchar. * lib/strftime.c (DO_MULTIBYTE): Assume <wchar.h>. * modules/strtol (Depends-on): Depend on wchar. * lib/strtol.c: Assume <wchar.h>. * modules/wcwidth (Depends-on): Depend on wchar. * lib/wcwidth.h: Assume <wchar.h>. * m4/wcwidth.m4: Likewise.
* * MODULES.html.sh: New module wctype.Paul Eggert2006-12-221-3/+1
| | | | | | | | | | | | | | | * lib/wctype_.h, m4/wctype.m4, modules/wctype: New files. * lib/fnmatch.c: Don't bother to include <wchar.h> before <wctype.h>, since the new wctype module should fix this. * lib/quotearg.c: Include <wctype.h> unconditionally, since the wctype module should arrange for it. * lib/regex_internal.h: Likewise. * m4/quotearg.m4 (gl_QUOTEARG): Don't check for wctype.h or iswprint, since the wctype module should handle this now. * m4/regex.m4 (gl_PREREQ_REGEX): Don't check for wctype.h. * modules/fnmatch (Depends-on): Add wctype. * modules/quotearg (Depends-on): Likewise. * modules/regex (Depends-on): Likewise.
* * lib/fnmatch.c (WIDE_CHAR_SUPPORT): Require HAVE_ISWCTYPE, too.Paul Eggert2006-12-041-1/+1
| | | | | | * lib/regex_internal.h (RE_ENABLE_I18N): Likewise. * m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Check for iswctype, too. * m4/regex.m4 (gl_PREREQ_REGEX): Likewise.
* Fix some incompatibilities with gcc -ansi -pedantic.Paul Eggert2006-11-271-1/+1
| | | | | | | | | | | * lib/regex.h (__restrict_arr): Don't use the [restrict] syntax if compiling pedantically with GCC, unless it's C99 or later. Don't trust sys/cdefs.h's definition of __restrict_arr, either, as it mishandles gcc -ansi -pedantic as well. * lib/regex_internal.h (re_token_t): Don't use enum bitfields if gcc -pedantic. * lib/regexec.c (check_node_accept_bytes): Don't use auto initializers for struct if -pedantic, unless it's C99 or later.
* Add and change modules to make it easier for coreutils to usePaul Eggert2006-08-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gnulib-tool. * lib/cycle-check.h: Include <stdint.h> unconditionally, since we now assume the stdint module. Do not include inttypes.h. * lib/fsusage.h: Likewise. * lib/getndelim2.c: Likewise. * lib/human.h: Likewise. * lib/inttostr.h: Likewise. * lib/obstack.c: Likewise. * lib/regex_internal.h: Likewise. * lib/tempname.c: Likewise. * lib/utimecmp.c: Likewise. * lib/xstrtol.h: Likewise. * lib/stat_.h: Fix typo: HAVE_FUNC_LSTAT -> HAVE_LSTAT. * lib/strtoimax.c: Adjust to macro name changes in Autoconf, e.g., HAVE_LONG_LONG -> HAVE_LONG_LONG_INT. * lib/xtime.h: Likewise. Remove files that are no longer needed by their respective modules. * m4/obstack.m4: Remove. * m4/strerror_r.m4: Remove. * m4/uint32_t.m4: Remove. * m4/uintptr_t.m4: Remove. * m4/ullong_max.m4: Remove. * m4/xstrtoimax.m4: Remove. * m4/xstrtoumax.m4: Remove. * cycle-check.m4 (gl_CYCLE_CHECK): Do not require gl_AC_TYPE_UINTMAX_T, gl_STRUCT_DEV_INO, or gl_SAME_INODE, since gnulib dependencies now capture this. * cycle-check.m4 (gl_CYCLE_CHECK): Do not use AC_LIBSOURCES, since gnulib modules now do this. * fsusage.m4 (gl_FSUSAGE): Likewise. * human.m4 (gl_HUMAN): Likewise. * inttostr.m4 (gl_INTTOSTR): Likewise. * xstrtol.m4 (gl_XSTRTOL): Likewise. * filemode.m4 (gl_FILEMODE): Require AC_STRUCT_ST_DM_MODE. * filemode.m4 (gl_PREREQ_FSUSAGE_EXTRA): Do not require gl_AC_TYPE_INTMAX_T or gl_AC_TYPE_UINTMAX_T, since we now require stdint. * human.m4 (gl_HUMAN): Likewise. * inttostr.m4 (gl_PREREQ_INTTOSTR): Likewise. * mkstemp.m4 (gl_PREREQ_TEMPNAME): Likewise. * strtoimax.m4 (gl_PREREQ_STRTOIMAX): Likewise. * strtoumax.m4 (gl_PREREQ_STRTOUMAX): Likewise. * xstrtol (gl_XSTRTOL): Likewise. * gethrxtime.m4 (gl_XTIME): gl_AC_TYPE_LONG_LONG -> AC_TYPE_LONG_LONG_INT. * strtoimax.m4 (gl_PREREQ_STRTOIMAX): Likewise. * strtoll.m4 (gl_FUNC_STRTOLL): Likewise. * strtoull.m4 (gl_FUNC_STRTOULL): Likewise, for unsigned long. * strtoumax.m4 (gl_PREREQ_STRTOUMAX): Likewise. * human.m4 (gl_HUMAN): Do not require AM_STDBOOL_H since we depend on stdbool. * xstrtol.m4 (gl_PREREQ_XSTRTOL_H, gl_PREREQ_XSTRTOL): Remove. (gl_PREREQ_XSTRTOUL): Remove. * ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Check for hasmntopt. * posixver.m4: Fix comment since head -1 now works even in POSIX mode. * modules/backupfile (Files): Remove m4/d-ino.m4. (Depends-on): Add d-ino. * modules/cycle-check (Depends-on): Add stdint. (lib_SOURCES): Add cycle-check.h. * modules/d-ino: New module. * modules/d-type: New module. * modules/error (Files): Remove m4/strerror_r.m4. * modules/filemode (Files): Add m4/st_dm_mode.m4. * modules/fsuage (Files): Remove m4/ulonglong.m4, m4/stdint_h.m4, m4/inttypes_h.m4, m4/uintmax_t.m4. (Depends-on): Add stdint. (lib_SOURCES): Add fsusage.h. * modules/getcwd (Files): Remove d-ino.m4. (Depends-on): Add d-ino. * modules/getndelim2 (Depends-on): Add stdint. * modules/glob (Files): Remove m4/d-type.m4. (Depends-on): Add d-type. * modules/host-os: New module. * modules/human (Files): Remove m4/ulonglong.m4, m4/stdint_h.m4, m4/inttypes_h.m4, m4/uintmax_t.m4. * Depends-on: Add stdint. (lib_SOURCES): Add human.h. * modules/inttostr (Files): Remove m4/intmax_t.m4, m4/inttostr.m4, m4/inttypes_h.m4, m4/longlong.m4, m4/stdint_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4. (Depends-on): Add stdint. (EXTRA_DIST): Add inttostr.h. * modules/lchmod: New module. * modules/link-follow: New module. * modules/mkdir-p (Files): Remove lib/lchmod.h, m4/lchmod.m4. (Depends-on): Add lchmod. * modules/mkstemp (Files): Remove m4/ulonglong.m4, m4/stdint_h.m4, m4/inttypes_h.m4, m4/uintmax_t.m4. (Depends-on): Add stdint. * modules/obstack (Files): Remove m4/inttypes_h.m4, m4/obstack.m4, m4/stdint_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4. (Depends-on): Add stdint. (configure.ac): Change gl_OBSTACK to AC_FUNC_OBSTACK. * modules/perl: New module. * modules/regex (Depends-on): Add stdint. * modules/rmdir-errno: New module. * modules/strtoimax (Files): Remove m4/stdint_h.m4, m4/inttypes_h.m4, m4/intmax_t.m4. (Depends-on): Add stdint. * modules/strtoumax (Files): Remove m4/stdint_h.m4, m4/inttypes_h.m4, m4/uintmax_t.m4. (Depends-on): Add stdint. * modules/unlink-busy: New module. * modules/utimecmp (Depends-on): Add stdint. * modules/uptime: New module. * modules/winsz-ioctl: New module. * modules/winsz-termios: New module. * modules/xnanosleep (Depends-on): Add nanosleep. * modules/ullong_max: Remove. * modules/xstrtoimax (Files): Remove m4/xstrtoimax.m4. (configure.ac): Remove gl_XSTRTOIMAX; no action needed now. * modules/xstrtol (Files): Remove m4/ulonglong.m4, m4/longlong.m4, m4/stdint_h.m4, m4/inttypes_h.m4, m4/uintmax_t.m4, m4/intmax_t.m4. (Depends-on): Add inttypes. (lib_SOURCES): Add xstrtol.h. * modules/xstrtoumax (Files): Remove m4/xstrtoumax.m4. (configure.ac): Remove gl_XSTRTOUMAX; no action needed now. * MODULES.html.sh: Move 'assert' into the assert section. Move 'dummy' into the linking section. Remove ullong_max. Add section for compatibility checks for POSIX:2001 functions, and put d-ino, d-type, link-follow, rmdir-errno, unlink-busy, winsz-ioctl, and winsz-termios into it. Add lchmod. Add top-level Misc section and put host-os, perl, and uptime into it.
* * regex_internal.h (struct re_dfa_t) [!_LIBC]: Avoid invalid C89Eric Blake2006-07-291-1/+2
| | | | macro expansion.
* * lib/.cppi-disable: Add wcwidth.Paul Eggert2006-07-061-1/+1
| | | | | | | | | | | | | | | | | * lib/fnmatch.c (ISBLANK): Remove. All uses changed to isblank. (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro. (ISGRAPH): Remove. All uses changed to isgraph. (FOLD) [!defined _LIBC]: Remove special case. * lib/getdate.y (lookup_word): Remove no-longer-needed call to islower. * lib/regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not HAVE_ISBLANK. * lib/strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special case. * m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Don't check for getenv decl; no longer needed. Check for isblank decl. * m4/mkstemp.m4 (gl_PREREQ_TEMPNAME): Don't check for getenv decl. * m4/regex.m4 (gl_PREREQ_REGEX): Dheck for isblank decl instead of existence.
* Merge regex changes from libc, removing some of ourPaul Eggert2006-04-101-122/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX-conformance changes that were rejected and redoing them in a less-intrusive way. * lib/regcomp.c (re_compile_internal, init_dfa): Length arg is now size_t, not Idx. All uses changed. (peek_token): Forward decl now says internal_function. (__re_error_msgid, __re_error_msgid_idx): Now static rather than extern with attribute_hidden. (re_compile_pattern) [!defined _LIBC]: Use K&R-style defn. For some reason libc prefers K&R style defns for external functions. (regerror) [!defined _LIBC]: Likewise. (re_set_syntax, re_compile_fastmap, regcomp, regfree, re_comp): (seek_collating_symbol_entry, lookup_collation_sequence_value): (build_range_exp, build_collating_symbol): Use K&R-style defn. (re_compile_fastmap): Use '\0' to memset, not 0. (utf8_sb_map): Make the calculations more obvious. (init_dfa, parse_bracket_exp, build_charclass_op): Call calloc and cast result, as glibc does. (init_word_char, fetch_token, peek_token, peek_token_bracket): (build_range_exp, build_collating_symbol): Now internal functions. * lib/regex.c [!defined _LIBC]: Allow compiling with C++ compilers. * lib/regex.h (__USE_GNU_REGEX): New macro. Don't depend on _REGEX_SOURCE any more; depend on _GNU_SOURCE instead. Don't depend on VMS; depend on __VMS instead, for POSIX namespace cleanness. (regoff_t): Define to ssize_t, not long int. Remove the REG_ macros named below. Instead, make the old names (e.g., RE_BACKSLASH_ESCAPE_IN_LISTS) visible only if __USE_GNU_REGEX. (REG_BACKSLASH_ESCAPE_IN_LISTS): (REG_BK_PLUS_QM, REG_CHAR_CLASSES, REG_CONTEXT_INDEP_ANCHORS): (REG_CONTEXT_INDEP_OPS, REG_CONTEXT_INVALID_OPS): (REG_DOT_NEWLINE, REG_DOT_NOT_NULL, REG_HAT_LISTS_NOT_NEWLINE): (REG_INTERVALS, REG_LIMITED_OPS, REG_NEWLINE_ALT): (REG_NO_BK_BRACES, REG_NO_BK_PARENS, REG_NO_BK_REFS): (REG_NO_BK_VBAR, REG_NO_EMPTY_RANGES): (REG_UNMATCHED_RIGHT_PAREN_ORD, REG_NO_POSIX_BACKTRACKING): (REG_NO_GNU_OPS, REG_DEBUG, REG_INVALID_INTERVAL_ORD): (REG_IGNORE_CASE, REG_CARET_ANCHORS_HERE): (REG_CONTEXT_INVALID_DUP, REG_NO_SUB, REG_SYNTAX_EMACS): (REG_SYNTAX_AWK, REG_SYNTAX_GNU_AWK, REG_SYNTAX_POSIX_AWK): (REG_SYNTAX_GREP, REG_SYNTAX_EGREP, REG_SYNTAX_POSIX_EGREP): (REG_SYNTAX_ED, REG_SYNTAX_SED, _REG_SYNTAX_POSIX_COMMON): (REG_SYNTAX_POSIX_BASIC, REG_SYNTAX_POSIX_MINIMAL_BASIC): (REG_SYNTAX_POSIX_EXTENDED, REG_SYNTAX_POSIX_MINIMAL_EXTENDED): (REG_DUP_MAX, REG_UNALLOCATED, REG_REALLOCATE, REG_FIXED): (REG_NREGS): Remove. All uses replaced by the old RE_* names. (RE_BACKSLASH_ESCAPE_IN_LISTS): (RE_BK_PLUS_QM, RE_CHAR_CLASSES, RE_CONTEXT_INDEP_ANCHORS): (RE_CONTEXT_INDEP_OPS, RE_CONTEXT_INVALID_OPS): (RE_DOT_NEWLINE, RE_DOT_NOT_NULL, RE_HAT_LISTS_NOT_NEWLINE): (RE_INTERVALS, RE_LIMITED_OPS, RE_NEWLINE_ALT): (RE_NO_BK_BRACES, RE_NO_BK_PARENS, RE_NO_BK_REFS): (RE_NO_BK_VBAR, RE_NO_EMPTY_RANGES): (RE_UNMATCHED_RIGHT_PAREN_ORD, RE_NO_POSIX_BACKTRACKING): (RE_NO_GNU_OPS, RE_DEBUG, RE_INVALID_INTERVAL_ORD): (RE_IGNORE_CASE, RE_CARET_ANCHORS_HERE): (RE_CONTEXT_INVALID_DUP, RE_NO_SUB): Don't bother having these macros be independent of each others' values, since they no longer exist in the POSIX name space. Rename the following member names back to their old names, unless !__USE_GNU_REGEX. All uses changed back. (buffer): Renamed from re_buffer. (allocated): Renamed from re_allocated. (used): Renamed from re_used. (syntax): Renamed from re_syntax. (fastmap): Renamed from re_fastmap. (translate): Renamed from re_translate. (can_be_null): Renamed from re_can_be_null. (regs_allocated): Renamed from re_regs_allocated. (fastmap_accurate): Renamed from re_fastmap_accurate. (no_sub): Renamed from re_no_sub. (not_bol): Renamed from re_not_bol. (not_eol): Renamed from re_not_eol. (newline_anchor): Renamed from re_newline_anchor. (num_regs): Renamed from rm_num_regs. (start): Renamed from rm_start. (end): Renamed from rm_end. (free_state): Move up a bit. * lib/regex_internal.h (inline) [__GNUC__ < 3 && defined _LIBC]: #define to be empty. (ASCII_CHARS): New macro, replacing all uses of 0x80 and/or SBC_MAX / 2 when that is what is intended. (SBC_MAX): Define to UCHAR_MAX + 1, not 256. (__re_error_msgid, __re_error_msgid_idx): Remove decls; not needed. (MAX): New macro. (re_xmalloc, re_calloc, re_xrealloc, re_x2realloc): Remove. All uses changed back to re_malloc, etc. It's now the caller's responsibility to check for overflow; all callers changed. (re_alloc_oversized, re_x2alloc_oversized, re_xnmalloc, re_xnrealloc): (re_x2nrealloc): Remove. (free_state): Remove decl. * lib/regexc.c (regexec, re_match, re_search, re_match_2, re_search_2): (re_set_registers, re_exec): Use K&R-style defn. 2006-01-31 Roland McGrath <roland@redhat.com> * lib/regcomp.c (calc_eclosure_iter): Remove dead variables. Reported by Mike Frysinger <vapier@gentoo.org>. 2006-01-15 Andreas Jaeger <aj@suse.de> [BZ #1950] * lib/regex_internal.c (re_string_reconstruct): Adjust for build_wcs_upper_buffer change. (build_wcs_upper_buffer): Change return type. 2005-12-10 Ulrich Drepper <drepper@redhat.com> * lib/regex_internal.h: Include <stdint.h> if available. 2005-12-06 Paolo Bonzini <bonzini@gnu.org> * lib/regex_internal.h (SIZE_MAX): Provide a default definition. 2005-10-14 Ulrich Drepper <drepper@redhat.com> * lib/regcomp.c: Adjust for changed secondary hash function. 2005-09-30 Ulrich Drepper <drepper@redhat.com> * lib/regex.h: Pretty printing. Clean up namespace a bit. 2005-09-30 Jakub Jelinek <jakub@redhat.com> * lib/regexec.c (update_cur_sifted_state, check_arrival, check_arrival_add_next_nodes): Avoid using uninitialized variable. 2005-09-06 Paul Eggert <eggert@cs.ucla.edu> Ulrich Drepper <drepper@redhat.com> [BZ #1302] * lib/regex_internal.h (bitset_t): Renamed from bitset. All uses changed. (bitset_word_t): Renamed from bitset_word. All uses changed. 2005-09-22 Ulrich Drepper <drepper@redhat.com> [BZ #281] * lib/regex.h: Define RE_TRANSLATE_TYPE as unsigned char *. * lib/regcomp.c: Remove unnecessary uses of unsigned RE_TRANSLATE_TYPE. * lib/regex_internal.h: Likewise. * lib/regex_internal.c: Likewise. * lib/regexec.c: Likewise. Based on a patch by Stepan Kasal <kasal@ucw.cz>. 2005-09-07 Ulrich Drepper <drepper@redhat.com> * lib/regexec.c (find_recover_state): Remove unnecessary initialization. (transit_state_bkref): Make DFA a const pointer. (get_subexp): Likewise. (check_arrival): Likewise. (update_cur_sifted_state): Likewise. (re_search_internal): Likewise. (prune_impossible_nodes): Likewise. (acquire_init_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (free_fail_stack_return): Likewise. (check_arrival_expand_ecl): Mark DFA parameter as const. (check_arrival_expand_ecl_sub): Likewise. (check_subexp_limits): Likewise. (sub_epsilon_src_nodes): Likewise. (add_epsilon_src_nodes): Likewise. (merge_state_array): Likewise. (update_regs): Likewise. (build_trtable): Likewise. (sift_states_backward): Mark MCTX parameter as const. (build_sifted_states): Likewise. (update_cur_sifted_state): Likewise. (sift_states_mkref): Likewise. (check_arrival_expand_ecl): Mark eclosure as const. (check_dst_limits_calc_pos_1): Likewise. * lib/regex_internal.h (re_match_context_t): Make dfa a const pointer. 2005-09-06 Ulrich Drepper <drepper@redhat.com> * lib/regexec.c (merge_state_with_log): Define dfa as const pointer. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (sift_states_iter_mb): Likewise. (check_arrival_add_next_nodes): Likewise. (check_node_accept_bytes): Change first parameter to pointer-to-const. [_LIBC] (re_search_2_stub): Use mempcpy. * lib/regex_internal.c (re_string_reconstruct): Avoid calling mbrtowc for very simple UTF-8 case. * lib/regex_internal.c (re_acquire_state): Make DFA pointer arg a pointer-to-const. (re_acquire_state_context): Likewise. * lib/regex_internal.h: Adjust prototypes. * lib/regex.c: Prevent using C++ compilers. * lib/regex_internal.c (re_acquire_state): Minor code rearrangement. (re_acquire_state_context): Likewise.
* * regex_internal.h (BITSET_WORD_BITS):Paul Eggert2006-01-101-1/+5
| | | | | Work around a bug in 64-bit PGC (before version 6.1-2), where the preprocessor mishandles large unsigned values as if they were signed.
* * regex_internal.h (__GNUC_PREREQ, always_inline, inline, pure):Paul Eggert2005-09-251-16/+1
| | | | | | | | | | | Remove. (__attribute): Define to empty unless GCC 3.1 or later. This works around a core dump on OpenBSD 3.4, which has GCC 2.95.3, which dumps core when given __attribute__(()). It also simplifies other tests, since we really don't want to bother with worrying about which ancient version of GCC supported what. Original problem reported by Yoann Vandoorselaere, with part of the fix suggested by Derek Price.
* (__attribute): Define to nothing for GCC 2.Paul Eggert2005-09-241-1/+1
| | | | | This works around a core dump on OpenBSD 3.4, which has GCC 2.95.3, which dumps core when given __attribute__(()).
* Sync from coreutils.Paul Eggert2005-09-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .cppi-disable: Add regcomp.c, regex_internal.c, regex_internal.h, stat-time.h. * argmatch.h: Include verify.h (ARGMATCH_VERIFY): Use verify rather than rolling our own. (ARGMATCH_ASSERT): Remove; unused. * canonicalize.c: Assume STDC_HEADERS. * exclude.c: Include "strcase.h". * regex_internal.h [!defined _LIBC]: Likewise. * getusershell.c: Include stdio--.h rather than stdio.h and stdio-safer.h. (getusershell): Call fopen, not fopen_safer. * save-cwd.c: Include fcntl--.h rather than fcntl.h. Do not include unistd-safer.h. (save_cwd): Don't call fd_safer; no longer needed now that we include fcntl--.h. * modules/argmatch (Depends-on): Add verify. * modules/getloadavg (Depends-on): Depend on fcntl-safer, not unistd-safer. * modules/save-cwd (Depends-on): Likewise. * backupfile.m4, calloc.m4, chown.m4, cloexec.m4, dup2.m4: * fileblocks.m4, free.m4, ftruncate.m4, getcwd.m4, getpagesize.m4: * getugroups.m4, group-member.m4, idcache.m4, link-follow.m4: * mkstemp.m4, mktime.m4, mountlist.m4, nanosleep.m4, pathmax.m4: * physmem.m4, posixver.m4, putenv.m4, safe-read.m4, same.m4: * save-cwd.m4, stdio-safer.m4, unistd-safer.m4, unlinkdir.m4: * userspec.m4, xgetcwd.m4, xreadlink.m4: Don't bother checking for string.h, stdlib.h, unistd.h. * fts.m4 (gl_FUNC_FTS_CORE): Don't require AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK; that's now the lstat module's job. * jm-macros.m4 (gl_MACROS): Likewise. * prereq.m4 (gl_PREREQ): Add gl_FUNC_LSTAT. * backupfile.c: Use ARGMATCH_VERIFY, just in case. * posixtm.c (posixtime) [lint]: Initialize *all* of tm0, not just the .tm_year member, since otherwise gcc-4.0 would now warn about tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday. * quotearg.c (quotearg_n_options): Change code to be suboptimal, in order to avoid an unsuppressible warning from gcc on 64-bit systems. * lstat.m4 (gl_FUNC_LSTAT): Use AC_LIBSOURCES to require lstat.c and lstat.h. Remove obsolete comment. * xreadlink.m4: Use AC_LIBSOURCES and AC_LIBOBJ. * xstrtod.m4: Likewise.
* * regcomp.c, regexec.c, regex_internal.c: Back out previousDerek R. Price2005-09-161-0/+13
| | | | | changes, consolidating in... * regex_internal.h: ...this file.
* * regex_internal.h: Blank `pure' for GNUC < 3.Derek R. Price2005-09-151-0/+1
| | | | | | | * regex_internal.c: Ditto, using this... (__GNUC_PREREQ): ...new macro. * regcomp.c, regexec.c: Blank `always_inline' for GNUC < 3.1 using... (__GNUC_PREREQ): ...this new macro.
* * regex_internal.h (bitset_not): Add parens to avoid gcc -Wall warning.Paul Eggert2005-09-061-1/+1
|
* Change bitset word type from unsigned int to unsigned long int,Paul Eggert2005-09-061-32/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as this has better performance on typical 64-bit hosts. Port bitset code to hosts with unusual word sizes. * lib/regcomp.c (build_equiv_class, build_charclass): (build_range_exp, build_collating_symbol): Prefer bitset to re_bitset_ptr_t in prototypes, when the actual argument is a bitset. This is merely a style issue, but it makes it clearer that an entire array is expected. (re_compile_fastmap_iter, init_dfa, init_word_char, optimize_subexps): * lib/regcomp.c (lower_subexp, parse_bracket_exp): (built_charclass_op): Port to the case where bitset_word is not the same as unsigned int. * lib/regex_internal.h (bitset_set, bitset_clear, bitset_contain): (bitset_not, bitset_merge, bitset_set_all, bitset_mask): Likewise. * lib/regexec.c (check_dst_limits_calc_pos_1): (check_subexp_matching_top): (build_trtable, group_nodes_into_DFAstates): Likewise. * lib/regcomp.c (re_compile_fastmap_iter, utf8_sb_map): (optimize_utf8): Don't assume that SBC_MAX is a multiple of BITSET_WORD_BITS. * lib/regex_internal.h (bitset_set_all, bitset_not): Likewise. * lib/regexec.c (group_nodes_into_DFAstates): Likewise. * lib/regcomp.c (utf8_sb_map): Don't assume UINT_MAX == 0xffffffff. * lib/regcomp.c (optimize_subexps, lower_subexp): Work even if bitset_word has holes in its bitwise representation. * lib/regex_internal.h (BITSET_WORD_BITS): Likewise. * lib/regexec.c (check_dst_limits_calc_pos_1): (heck_subexp_matching_top): Likewise. * lib/regex_internal.c (re_string_reconstruct): Don't assume UCHAR_MAX == 255. * lib/regex_internal.h (bitset_set_all): Likewise. * lib/regex_internal.h (BITSET_WORD_BITS): Renamed from UINT_BITS. All uses changed. (BITSET_WORDS): Renamed from BITSET_UINTS. All uses changed. (bitset_word): New type, replacing 'unsigned int' for bitset uses. All uses changed. (BITSET_WORD_MAX): New macro. (bitset_set, bitset_clear, bitset_contain, bitset_empty): (bitset_set_all, bitset_copy): Now inline functions, not macros. (bitset_empty, bitset_copy): Prefer sizeof (bitset) to multiplying it out ourselves. (bitset_not_merge): Remove; unused. (bitset_contain): Return bool, not unsigned int with one bit on. All callers changed. * lib/regexec.c (build_trtable): Don't assume bitset has no stricter alignment than re_node_set; do this by defining a new internal type struct dests_alloc and using it to allocate memory. * config/srclist.txt: Add glibc bug 1302.
* Check for arithmetic overflow when calculating sizes, to preventPaul Eggert2005-09-021-0/+60
| | | | | | | | | | | | | | | | | | | | | some buffer-overflow issues. These patches are conservative, in the sense that when I couldn't determine whether an overflow was possible, I inserted a run-time check. * regex_internal.h (re_xmalloc, re_xrealloc, re_x2realloc): New macros. (SIZE_MAX) [!defined SIZE_MAX]: New macro. (re_alloc_oversized, re_x2alloc_oversized, re_xnmalloc): (re_xnrealloc, re_x2nrealloc): New inline functions. * lib/regcomp.c (init_dfa, analyze, build_range_exp, parse_bracket_exp): (build_equiv_class, build_charclass): Check for arithmetic overflow in size expression calculations. * lib/regex_internal.c (re_string_realloc_buffers): (build_wcs_upper_buffer, re_node_set_add_intersect): (re_node_set_init_union, re_node_set_insert, re_node_set_insert_last): (re_dfa_add_node, register_state): Likewise. * lib/regexec.c (re_search_stub, re_copy_regs, re_search_internal): (prune_impossible_nodes, push_fail_stack, set_regs, check_arrival): (build_trtable, extend_buffers, match_ctx_init, match_ctx_add_entry): (match_ctx_add_subtop, match_ctx_add_sublast): Likewise.
* Use bool where appropriate.Paul Eggert2005-09-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/regcomp.c (re_set_fastmap): ICASE arg is bool, not int. All callers changed. (calc_eclosure_iter): Likewise, for ROOT arg. (parse_bracket_element): Likewise, for ACCEPT_HYPHEN arg. (build_charclass_op): Likewise, for NON_MATCH arg. * lib/regex_internal.c (re_string_allocate, re_string_construct): (re_string_construct_common): Likewise, for ICASE arg. * lib/regexec.c (re_search_2_stub, re_search_stub): Likewise, for RET_LEN arg. (check_matching): Likewise, for FL_LONGEST_MATCH arg. (set_regs): Likewise, for FL_BACKTRACK arg. * lib/regcomp.c (re_compile_fastmap_iter, optimize_utf8): (duplicate_node_closure, calc_inveclosure, calc_eclosure): (calc_eclosure_iter, parse_bracket_exp): Use bool for internal variables that are booleans. * lib/regexec.c (re_search_internal, check_matching): (proceed_next_node): (set_regs, build_sifted_states, sift_states_bkref): (check_arrival_add_next_nodes, check_arrival_expand_ecl_sub): (expand_bkref_cache, build_trtable, group_nodes_into_DFAstates): (find_collation_sequence_value): Likewise. * lib/regex_internal.c (re_node_set_insert, re_node_set_insert_last): (re_node_set_compare): Return bool, not int. All callers changed. * lib/regexec.c (check_halt_node_context, check_dst_limits): (build_trtable, check_node_accept): Likewise. * lib/regex_internal.h: Include stdbool.h. Fix bugs uncovered when converting to bool. * lib/regcomp.c (calc_eclosure_iter): Check for storage allocation failure instead of charging ahead blindly. * lib/regex_internal.c (register_state): Likewise. * lib/regexec.c (re_search_2_stub): Use simpler method than boolean for freeing internal storage. (group_nodes_into_DFA_states): Use unsigned int, not int, for bitset pieces used as boolean, to avoid undefined behavior on hosts that do int overflow checking. * config/srclist.txt: Add glibc bug 1285.
* On 64-bit hosts (where size_t is 64 bits and int is 32 bits), thePaul Eggert2005-08-311-62/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | old glibc regex code mishandles strings longer than 2**31 bytes. This patch fixes this when the regex code is used in gnulib (i.e., outside glibc). * lib/regex.h (_REGEX_LARGE_OFFSETS): New feature-test macro, governing whether the rest of this patch is active. By default, the macro is disabled and the patch has no effect. (regoff_t) [defined _REGEX_LARGE_OFFSETS]: Define to off_t, not int. (__re_idx_t, __re_size_t, __re_long_size_t): New types. (struct re_pattern_buffer, re_search, re_search_2, re_match): (re_match_2, re_set_registers): Use the new types. * lib/regex_internal.h (Idx, re_hashval_t): New types. (REG_MISSING, REG_ERROR, REG_VALID_INDEX, REG_VALID_NONZERO_INDEX): New macros. (re_node_set, re_charset_t, re_token_t, re_string_realloc_buffers): (re_string_context_at, bin_tree_t, re_dfastate_t): (struct re_state_table_entry, state_array_t, re_sub_match_last_t): (re_sub_match_top_t, re_match_context_t, re_sift_context_t): (struct re_fail_stack_ent_t, struct re_fail_stack_t, struct re_dfa_t): (re_string_char_size_at, re_string_wchar_at): (re_string_elem_size_at): Use the new types and macros to port to 64-bit hosts. Use unsigned types for internal values, so that the code mostly works even for arrays larger than SSIZE_MAX. * lib/regcomp.c (re_compile_internal, init_dfa, duplicate_node): (search_duplicated_node, calc_eclosure_iter, fetch_number): (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp): (build_equiv_class, build_charclass, re_compile_fastmap_iter): (free_dfa_content, create_initial_state, optimize_utf8, analyze): (optimize_subexps, calc_first, link_nfa_nodes, duplicate_node_closure): (calc_inveclosure, parse_dup_op, build_range_exp): (build_collating_symbol, parse_bracket_exp, build_charclass_op): (fetch_number, create_token_tree, mark_opt_subexp): Likewise. * lib/regex_internal.c (re_string_construct_common, create_ci_newstate): (create_cd_newstate, re_string_allocate, re_string_construct): (re_string_realloc_buffers, build_wcs_upper_buffer): (re_string_skip_chars, build_upper_buffer, re_string_translate_buffer): (re_string_reconstruct, re_string_peek_byte_case): (re_string_fetch_byte_case, re_string_context_at): (re_node_set_alloc, re_node_set_init_1, re_node_set_init_2): (re_node_set_init_copy, re_node_set_add_intersect): (re_node_set_init_union, re_node_set_merge, re_node_set_insert): (re_node_set_insert_last, re_node_set_compare, re_node_set_contains): (re_node_set_remove_at, re_dfa_add_node, calc_state_hash): (re_acquire_state, re_acquire_state_context, register_state): Likewise. * lib/regex.c (match_ctx_init, match_ctx_add_entry, search_cur_bkref_entry): (match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init): (re_search_internal, re_search_2_stub, re_search_stub) (re_copy_regs, check_matching, check_halt_state_context, update_regs): (push_fail_stack, sift_states_iter_mb, build_sifted_states): (update_cur_sifted_state, check_dst_limits): (check_dst_limits_calc_pos_1, check_dst_limits_calc_pos): (check_subexp_limits, sift_states_bkref, merge_state_array): (check_subexp_matching_top, get_subexp, get_subexp_sub): (find_subexp_node, check_arrival, check_arrival_add_next_nodes): (check_arrival_expand_ecl, check_arrival_expand_ecl_sub): (expand_bkref_cache, check_node_accept_bytes): (group_nodes_into_DFAstates, check_node_accept, regexec, re_match): (re_search, re_match_2, re_search_2, prune_impossible_nodes): (acquire_init_state_context, check_halt_node_context): (proceed_next_node, pop_fail_stack, set_regs, free_fail_stack_return): (sift_states_backward, clean_state_log_if_needed): (sub_epsilon_src_nodes, add_epsilone_src_nodes, merge_state_with_log): (find_recover_state, transit_state_sb, transit_state_mb): (transit_state_bkref, build_trtable, match_ctx_clean): Likewise. * lib/regcomp.c (parse_dup_op): Add an extra test if Idx is unsigned, to work around an assumption that REG_MISSING is negative. * m4/regex.m4 (gl_REGEX): Require AC_SYS_LARGEFILE, Define _REGEX_LARGE_OFFSETS). Test for regoff_t/off_t bug in 64-bit and large-file glibc and in 32-bit large-file Solaris. * config/srclist.txt: Add glibc bug 1281.
* * lib/regcomp.c (re_compile_fastmap_iter, init_dfa, init_word_char):Paul Eggert2005-08-311-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | (optimize_subexps, lower_subexp): Don't assume 1<<31 has defined behavior on hosts with 32-bit int, since the signed shift might overflow. Use 1u<<31 instead. * lib/regex_internal.h (bitset_set, bitset_clear, bitset_contain): Likewise. * lib/regexec.c (check_dst_limits_calc_pos_1): (check_subexp_matching_top): Likewise. * lib/regcomp.c (optimize_subexps, lower_subexp): Use CHAR_BIT rather than 8, for clarity. * lib/regexec.c (check_dst_limits_calc_pos_1): (check_subexp_matching_top): Likewise. * lib/regcomp.c (init_dfa): Make table_size unsigned, so that we don't have to worry about portability issues when shifting it left. Remove no-longer-needed test for table_size > 0. * lib/regcomp.c (parse_sub_exp): Do not shift more bits than there are in a word, as the resulting behavior is undefined. * lib/regexec.c (check_dst_limits_calc_pos_1): Likewise; in one case, a <= should have been an <, and in another case the whole test was missing. * lib/regex_internal.h (BYTE_BITS): Remove. All uses changed to the standard name CHAR_BIT. * lib/regexec.c (match_ctx_add_entry): Don't assume that ~0 == -1; this is not true on one's complement and signed-magnitude hosts.
* * lib/regex_internal.h (re_sub_match_top_t): Remove unused memberPaul Eggert2005-08-311-2/+0
| | | | | | | next_last_offset. (struct re_dfa_t): Remove unused member states_alloc. * lib/regcomp.c (init_dfa): Don't initialize unused members. * config/srclist.txt: Add glibc bug 1273.
* * config/srclist.text: Add glibc bug 1248.Paul Eggert2005-08-261-65/+5
| | | | | | | | | | | | | | | | | | | | | | | * lib/regex_internal.h: Remove all references to RE_NO_INTERNAL_PROTOTYPES; no longer neeeded now that we assume C89 or better. (bitset_not, bitset_merge, bitset_not_merge): (bitset_mask, re_string_allocate, re_string_construct): (re_string_reconstruct, re_string_destruct, re_string_elem_size_at): (re_string_char_size_at, re_string_wchar_at, re_string_peek_byte_case): (re_string_fetch_byte_case, re_node_set_alloc, re_node_set_init_1): (re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect): (re_node_set_init_union, re_node_set_merge, re_node_set_insert): (re_node_set_insert_last, re_node_set_compare, re_node_set_contains): (re_node_set_remove_at, re_dfa_add_node, re_acquire_state): (re_acquire_state_context): Remove unnecessary forward decls. (re_string_char_size_at, re_string_wchar_at, re_string_elem_size_at): Put __attribute at function definition, now that the function decl has been removed. * lib/regex_internal.c (re_string_peek_byte_case): (re_string_fetch_byte_case, re_node_set_compare, re_node_set_contains): Likewise.
* Fix typo: __LIBC -> _LIBC.Paul Eggert2005-08-261-1/+1
|
* * config/srclist.txt: Add glibc bug 1245.Paul Eggert2005-08-261-0/+15
| | | | | | | | | | | | | * lib/regexec.c (set_regs): Don't alloca with an unbounded size. alloca modernization/simplification for regex. * lib/regex.c: Remove portability cruft for alloca. This no longer needs to be at the start of the file, and can be moved into regex_internal.h and simplified. * lib/regex_internal.h: Include <alloca.h>. (__libc_use_alloca) [!defined _LIBC]: New macro. * lib/regexec.c (build_trtable): Remove "#ifdef _LIBC", since the code now works outside glibc.
* Make regex safe for g++. This fixes one real bug (an "err"Paul Eggert2005-08-251-1/+3
| | | | | | | | | | | | | | | | that should have been "*err"). * config/srclist.txt: Add glibc bug 1241. * lib/regex_internal.h (re_calloc): New macro, consistent with re_malloc etc. All callers of calloc changed to use re_calloc. * lib/regex_internal.c (build_wcs_upper_buffer): Return reg_errcode_t, not int. All callers changed. * lib/regcomp.c (re_compile_fastmap_iter): Don't use alloca (mb_cur_max); just use an array of size MB_LEN_MAX. * lib/regexec.c (push_fail_stack): Use re_realloc, not realloc. (find_recover_state): Change "err" to "*err"; this fixes what appears to be a real bug. (check_arrival_expand_ecl_sub): Be consistent about reg_errcode_t versus int.
* * config/srclist.txt: Add glibc bug 1237.Paul Eggert2005-08-241-3/+3
| | | | | | | | | | | * lib/regcomp.c, lib/regex_internal.c, lib/regex_internal.h: * lib/regexec.c: All uses of recently-renamed identifiers changed to use the new, POSIX-compliant names. The code will build and run just fine without these changes, but it's better to eat our own dog food and use the standard-conforming names. * m4/regex.m4 (gl_REGEX): Use POSIX-compliant spellings when testing for GNU regex features.
* * config/srclist.txt: Add glibc bugs 1220, 1221, 1222.Paul Eggert2005-08-201-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/regcomp.c: (re_compile_pattern, re_set_syntax, re_compile_fastmap): (re_compile_fastmap_iter, regcomp, regerror, regfree): (re_compile_internal, init_dfa, init_word_char, free_workarea_compile): (create_initial_state, optimize_utf8, analyze, postorder, preorder): (optimize_subexps, lower_subexps, lower_subexp, calc_first, calc_next): (link_nfa_nodes, duplicate_node_closure, search_duplicated_node): (duplicate_node, calc_inveclosure, calc_eclosure, calc_eclosure_iter): (fetch_token, peek_token, peek_token_bracket, parse, parse_reg_exp): (parse_branch, parse_expression, parse_sub_exp, parse_dup_op): (build_range_exp, build_collating_symbol, parse_bracket_exp): (parse_bracket_element, parse_bracket_symbol, build_equiv_class): (build_charclass, build_charclass_op, fetch_number, create_tree): (create_token_tree, mark_opt_subexp, duplicate_tree): Use prototypes rather than old-style definitions. * lib/regex_internal.c: (re_string_allocate, re_string_construct, re_string_realloc_buffers): (re_string_construct_common, build_wcs_buffer, build_wcs_upper_buffer): (re_string_skip_chars, build_upper_buffer, re_string_translate_buffer): (re_string_reconstruct, re_string_peek_byte_case): (re_string_fetch_byte_case, re_string_destruct, re_string_context_at): (re_node_set_alloc, re_node_set_init_1, re_node_set_init_2): (re_node_set_init_copy, re_node_set_add_intersect): (re_node_set_init_union, re_node_set_merge, re_node_set_insert): (re_node_set_insert_last, re_node_set_compare, re_node_set_contains): (re_node_set_remove_at, re_dfa_add_node, calc_state_hash): (re_acquire_state, re_acquire_state_context, register_state): (create_ci_newstate, create_cd_newstate, free_state): Likewise. * lib/regexec.c (regexec, re_match, re_search, re_match_2, re_search_2): (re_search_2_stub, re_search_stub, re_copy_regs, re_set_registers): (re_search_internal, prune_impossible_nodes): (acquire_init_state_context, check_matching, static): (check_halt_node_context, check_halt_state_context, proceed_next_node): (push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return): (update_regs, sift_states_backward, build_sifted_states): (clean_state_log_if_needed, merge_state_array): (update_cur_sifted_state, add_epsilon_src_nodes): (sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos_1): (check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref): (sift_states_iter_mb, transit_state, merge_state_with_log, static): (find_recover_state, check_subexp_matching_top, transit_state_mb): (transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node): (check_arrival, check_arrival_add_next_nodes): (check_arrival_expand_ecl, check_arrival_expand_ecl_sub): (expand_bkref_cache, build_trtable, group_nodes_into_DFAstates): (check_node_accept_bytes, check_node_accept, extend_buffers): (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_add_entry): (search_cur_bkref_entry, match_ctx_add_subtop, match_ctx_add_sublast): (sift_ctx_init): Likewise. * lib/regex_internal.h: (re_string_allocate, re_string_construct, re_string_reconstruct): (re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer): (build_upper_buffer, re_string_translate_buffer, re_string_destruct): (re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at): (re_string_context_at, re_string_peek_byte_case): (re_string_fetch_byte_case): Declare even if RE_NO_INTERNAL_PROTOTYPES is defined, since we now use prototypes always. * lib/regex.h (_RE_ARGS): Remove. No longer needed, since we assume C89 or better. All uses removed.
* * modules/regex (Files): Add lib/regex_internal.c,Paul Eggert2005-07-071-0/+808
lib/regex_internal.h, lib/regexec.c, lib/regcomp.c, m4/codeset.m4. (Depends-on): Add extensions. (Makefile.am): Remove lib_SOURCES; now done by m4 code. * config/srclist.txt: Add regcomp.c, regex.c, regex.h, regex_internal.c, regexec.c. Add regex_internal.h too, but as a comment, since the libc version is currently broken in gnulib mode. * lib/regex.c, lib/regex.h: Sync from libc. * lib/regcomp.c, lib/regexec_internal.c, lib/regex_internal.h, lib/regexec.c: New files, synced from libc, except that regex_internal.h currently has a small porting fix. * m4/regex.m4: Adjust to new libc regex implementation. (gl_INCLUDED_REGEX): Add AC_LIBSOURCES for all the .c and .h parts of (the new) regex. Quote the m4 stuff better. Check for RE_ICASE bug of old gnulib. Check for REG_STARTEND of recent libc. Rename local variables from jm_* to gl_*. Quote operand of "test -f". Say "recent enough" version of libc, not "version 2". (gl_PREREQ_REGEX): Remove AC_FUNC_ALLOCA, since alloca is a prerequisite module. Remove AC_HEADER_STDC; no longer needed. Check for locale.h, isblank, mbrtowc, wcrtomb, wcscoll. Remove check for btowc, isascii. Require AM_LANGINFO_CODESET.