2002-02-28 07:40:08 +01:00
|
|
|
/* Extended regular expression matching and search library.
|
2015-01-02 17:28:19 +01:00
|
|
|
Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
2001-07-06 06:58:11 +02:00
|
|
|
This file is part of the GNU C Library.
|
2002-02-28 07:40:08 +01:00
|
|
|
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
1995-05-18 11:00:09 +02:00
|
|
|
|
1997-02-15 05:31:36 +01:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 06:58:11 +02: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 11:00:09 +02:00
|
|
|
|
1997-02-15 05:31:36 +01: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 06:58:11 +02:00
|
|
|
Lesser General Public License for more details.
|
1995-05-18 11:00:09 +02:00
|
|
|
|
2001-07-06 06:58:11 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-10 00:18:22 +01:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1995-05-18 11:00:09 +02:00
|
|
|
|
2004-01-14 05:11:30 +01: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 23:15:13 +02: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 05:11:30 +01:00
|
|
|
#endif
|
|
|
|
|
2002-02-28 07:40:08 +01:00
|
|
|
#ifdef _LIBC
|
1998-04-08 22:27:31 +02:00
|
|
|
/* We have to keep the namespace clean. */
|
2003-11-16 08:14:28 +01: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 22:27:31 +02:00
|
|
|
__regerror(errcode, preg, errbuf, errbuf_size)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_set_registers(bu, re, nu, st, en) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_set_registers (bu, re, nu, st, en)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_match(bufp, string, size, pos, regs) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_match (bufp, string, size, pos, regs)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_search(bufp, string, size, startpos, range, regs) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_search (bufp, string, size, startpos, range, regs)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_compile_pattern(pattern, length, bufp) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_compile_pattern (pattern, length, bufp)
|
2003-11-16 08:14:28 +01: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 22:27:31 +02:00
|
|
|
__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
|
|
|
|
|
|
|
|
# include "../locale/localeinfo.h"
|
2001-06-19 02:43:55 +02:00
|
|
|
#endif
|
|
|
|
|
2004-01-30 06:22:32 +01: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-31 01:09:11 +02:00
|
|
|
/* This header defines the MIN and MAX macros. */
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
2003-02-21 02:52:32 +01:00
|
|
|
#include <regex.h>
|
|
|
|
#include "regex_internal.h"
|
2002-03-12 03:04:08 +01:00
|
|
|
|
2003-02-21 02:52:32 +01:00
|
|
|
#include "regex_internal.c"
|
2002-02-28 07:40:08 +01:00
|
|
|
#include "regcomp.c"
|
|
|
|
#include "regexec.c"
|
2002-04-25 00:02:03 +02: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
|