2002-02-28 06:40:08 +00:00
|
|
|
/* Extended regular expression matching and search library.
|
2014-01-01 11:03:15 +00:00
|
|
|
Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
2001-07-06 04:58:11 +00:00
|
|
|
This file is part of the GNU C Library.
|
2002-02-28 06:40:08 +00:00
|
|
|
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
1995-05-18 09:00:09 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1995-05-18 09:00:09 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1995-05-18 09:00:09 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1995-05-18 09:00:09 +00:00
|
|
|
|
2004-01-14 04:11:30 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
* posix/regex_internal.h (re_sub_match_top_t): Remove unused member
next_last_offset.
(struct re_dfa_t): Remove unused member states_alloc.
* posix/regcomp.c (init_dfa): Don't initialize unused members.
2005-08-25 Paul Eggert <eggert@cs.ucla.edu>
* posix/regexec.c (set_regs): Don't alloca with an unbounded size.
alloca modernization/simplification for regex.
* posix/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.
* posix/regex_internal.h: Include <alloca.h>.
(__libc_use_alloca) [!defined _LIBC]: New macro.
* posix/regexec.c (build_trtable): Remove "#ifdef _LIBC",
since the code now works outside glibc.
2005-09-06 Ulrich Drepper <drepper@redhat.com>
* include/regex.h: Remove use of _RE_ARGS.
2005-08-25 Paul Eggert <eggert@cs.ucla.edu>
* posix/regexec.c (find_recover_state): Change "err" to "*err".
2005-08-24 Paul Eggert <eggert@cs.ucla.edu>
* posix/regcomp.c (regerror): Pointer args are 'restrict',
as per POSIX.
* posix/regex.h (regerror): Likewise.
* manual/pattern.texi (POSIX Regexp Compilation): Likewise.
Similarly for regcomp and regexec. Also, first 2 args of regexec
and 2nd arg of regerror are const.
* posix/regex.c: Do not include <sys/types.h>, as POSIX no longer
requires this. (The code never needed it.)
2005-08-20 Paul Eggert <eggert@cs.ucla.edu>
* posix/regexec.c (sift_states_bkref): re_node_set_insert returns
int, not reg_errcode_t.
* posix/regex_internal.c (calc_state_hash): Put 'inline' before type,
since some broken compilers warn about it otherwise.
* posix/regcomp.c (create_initial_state): Remove duplicate decl.
2005-08-20 Paul Eggert <eggert@cs.ucla.edu>
* posix/regex.h (_RE_ARGS): Remove. No longer needed, since we assume
C89 or better. All uses removed.
2005-09-06 Ulrich Drepper <drepper@redhat.com>
* posix/regex.c: Prevent using C++ compilers.
2005-08-19 Paul Eggert <eggert@cs.ucla.edu>
* posix/regcomp.c (duplicate_node): Return new index, not an error
code, and let the caller return REG_ESPACE if out of space. This
removes an uninitialied-variable warning with GCC 4.0.1, and also
avoids taking the address of a local variable. All callers
changed.
2005-09-06 Ulrich Drepper <drepper@redhat.com>
* include/time.h (__strptime_internal): Rename parameter to avoid
bogus compiler warning.
2005-08-19 Jim Meyering <jim@meyering.net>
* posix/regexec.c (proceed_next_node): Redo local variables to
avoid GCC shadowing warnings.
2005-09-06 Ulrich Drepper <drepper@redhat.com>
* posix/regex_internal.c (re_acquire_state): Minor code rearrangement.
(re_acquire_state_context): Likewise.
2005-08-19 Paul Eggert <eggert@cs.ucla.edu>
* posix/regex_internal.c (re_string_realloc_buffers):
(re_node_set_insert, re_node_set_insert_last, re_dfa_add_node):
Rename local variables to avoid GCC shadowing warnings.
2005-07-08 Eric Blake <ebb9@byu.net>
Paul Eggert <eggert@cs.ucla.edu>
* posix/regcomp.c (init_dfa): Store __btowc value in wint_t, not
wchar_t. Remove now-unnecessary cast.
(build_range_exp): Likewise.
2005-09-06 21:15:13 +00:00
|
|
|
/* Make sure noone compiles this code with a C++ compiler. */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
# error "This is C code, use a C compiler"
|
2004-01-14 04:11:30 +00:00
|
|
|
#endif
|
|
|
|
|
2002-02-28 06:40:08 +00:00
|
|
|
#ifdef _LIBC
|
1998-04-08 20:27:31 +00:00
|
|
|
/* We have to keep the namespace clean. */
|
2003-11-16 07:14:28 +00:00
|
|
|
# define regfree(preg) __regfree (preg)
|
|
|
|
# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
|
|
|
|
# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
|
|
|
|
# define regerror(errcode, preg, errbuf, errbuf_size) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__regerror(errcode, preg, errbuf, errbuf_size)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_set_registers(bu, re, nu, st, en) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__re_set_registers (bu, re, nu, st, en)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_match(bufp, string, size, pos, regs) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__re_match (bufp, string, size, pos, regs)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_search(bufp, string, size, startpos, range, regs) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__re_search (bufp, string, size, startpos, range, regs)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_compile_pattern(pattern, length, bufp) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__re_compile_pattern (pattern, length, bufp)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_set_syntax(syntax) __re_set_syntax (syntax)
|
|
|
|
# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
|
1998-04-08 20:27:31 +00:00
|
|
|
__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
|
2003-11-16 07:14:28 +00:00
|
|
|
# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
|
|
|
|
|
|
|
|
# include "../locale/localeinfo.h"
|
2001-06-19 00:43:55 +00:00
|
|
|
#endif
|
|
|
|
|
2004-01-30 05:22:32 +00:00
|
|
|
/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
|
|
|
|
GNU regex allows. Include it before <regex.h>, which correctly
|
|
|
|
#undefs RE_DUP_MAX and sets it to the right value. */
|
|
|
|
#include <limits.h>
|
|
|
|
|
2012-07-30 23:09:11 +00:00
|
|
|
/* This header defines the MIN and MAX macros. */
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
2003-02-21 01:52:32 +00:00
|
|
|
#include <regex.h>
|
|
|
|
#include "regex_internal.h"
|
2002-03-12 02:04:08 +00:00
|
|
|
|
2003-02-21 01:52:32 +00:00
|
|
|
#include "regex_internal.c"
|
2002-02-28 06:40:08 +00:00
|
|
|
#include "regcomp.c"
|
|
|
|
#include "regexec.c"
|
2002-04-24 22:02:03 +00:00
|
|
|
|
|
|
|
/* Binary backward compatibility. */
|
|
|
|
#if _LIBC
|
|
|
|
# include <shlib-compat.h>
|
|
|
|
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
|
|
|
link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
|
|
|
|
int re_max_failures = 2000;
|
|
|
|
# endif
|
|
|
|
#endif
|