backport: regex.c: Declare wcs functions only if compiling with MBS_SUPPORT.
Merge from glibc: * regex.c: Declare wcs functions only if compiling with MBS_SUPPORT. Don't use #elif for traditional C. * regex.c: Revamp memory allocation for WCHAR functions to not use too much stack. From-SVN: r44471
This commit is contained in:
parent
592a6d1d96
commit
c4b9cfe087
|
@ -1,3 +1,20 @@
|
||||||
|
2001-07-30 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
|
* regex.c: Declare wcs functions only if compiling with
|
||||||
|
MBS_SUPPORT.
|
||||||
|
Don't use #elif for traditional C.
|
||||||
|
|
||||||
|
2001-07-23 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* regex.c: Revamp memory allocation for WCHAR functions to
|
||||||
|
not use too much stack.
|
||||||
|
|
||||||
|
2001-07-30 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
|
* regex.c: Declare wcs functions only if compiling with
|
||||||
|
MBS_SUPPORT.
|
||||||
|
Don't use #elif for traditional C.
|
||||||
|
|
||||||
2001-07-25 Daniel Jacobowitz <drow@mvista.com>
|
2001-07-25 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
* Makefile.in (regex.o): Add dependency on config.h.
|
* Makefile.in (regex.o): Add dependency on config.h.
|
||||||
|
@ -299,12 +316,12 @@
|
||||||
2000-11-04 Hans-Peter Nilsson <hp@bitrange.com>
|
2000-11-04 Hans-Peter Nilsson <hp@bitrange.com>
|
||||||
|
|
||||||
* hashtab.c (htab_expand): Change to return int. Use calloc or
|
* hashtab.c (htab_expand): Change to return int. Use calloc or
|
||||||
xcalloc depending on htab->return_allocation_failure. Return zero
|
xcalloc depending on htab->return_allocation_failure. Return zero
|
||||||
if calloc fails.
|
if calloc fails.
|
||||||
(htab_create): Update comment to cover memory allocation.
|
(htab_create): Update comment to cover memory allocation.
|
||||||
(htab_try_create): New.
|
(htab_try_create): New.
|
||||||
(htab_find_slot_with_hash): Return NULL if htab_expand fails.
|
(htab_find_slot_with_hash): Return NULL if htab_expand fails.
|
||||||
Update comment to cover this.
|
Update comment to cover this.
|
||||||
|
|
||||||
2000-11-03 Hans-Peter Nilsson <hp@bitrange.com>
|
2000-11-03 Hans-Peter Nilsson <hp@bitrange.com>
|
||||||
|
|
||||||
|
@ -807,7 +824,7 @@ Tue May 30 15:07:52 2000 Jeffrey A Law (law@cygnus.com)
|
||||||
2000-05-23 Mike Stump <mrs@wrs.com>
|
2000-05-23 Mike Stump <mrs@wrs.com>
|
||||||
|
|
||||||
* Makefile.in (xmalloc.o): Add dependency for config.h, fixes make
|
* Makefile.in (xmalloc.o): Add dependency for config.h, fixes make
|
||||||
-j3.
|
-j3.
|
||||||
|
|
||||||
2000-05-18 J. David Anglin <dave@hiauly1.hia.nrc.ca>
|
2000-05-18 J. David Anglin <dave@hiauly1.hia.nrc.ca>
|
||||||
|
|
||||||
|
@ -1440,9 +1457,9 @@ Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
* choose-temp.c: Include stdlib.h.
|
* choose-temp.c: Include stdlib.h.
|
||||||
|
|
||||||
* cplus-dem.c (demangle_arm_pt): Remove unused prototype.
|
* cplus-dem.c (demangle_arm_pt): Remove unused prototype.
|
||||||
(snarf_numeric_literal): Constify first parameter.
|
(snarf_numeric_literal): Constify first parameter.
|
||||||
(code_for_qualifier): Avoid a gcc extension, make the parameter an
|
(code_for_qualifier): Avoid a gcc extension, make the parameter an
|
||||||
int, not a char.
|
int, not a char.
|
||||||
(demangle_qualifier): Likewise.
|
(demangle_qualifier): Likewise.
|
||||||
(demangle_signature): Cast the argument of a ctype function to
|
(demangle_signature): Cast the argument of a ctype function to
|
||||||
unsigned char.
|
unsigned char.
|
||||||
|
@ -1455,11 +1472,11 @@ Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
Cast the argument of a ctype function to unsigned char.
|
Cast the argument of a ctype function to unsigned char.
|
||||||
|
|
||||||
* floatformat.c (floatformat_to_double): Add explicit braces to
|
* floatformat.c (floatformat_to_double): Add explicit braces to
|
||||||
avoid ambiguous `else'.
|
avoid ambiguous `else'.
|
||||||
|
|
||||||
* fnmatch.c (fnmatch): Change type of variables `c', `c1',
|
* fnmatch.c (fnmatch): Change type of variables `c', `c1',
|
||||||
`cstart' and `cend' to unsigned char. Cast the argument of macro
|
`cstart' and `cend' to unsigned char. Cast the argument of macro
|
||||||
`FOLD', which uses ctype functions, to unsigned char.
|
`FOLD', which uses ctype functions, to unsigned char.
|
||||||
|
|
||||||
* objalloc.c (free): Add prototype.
|
* objalloc.c (free): Add prototype.
|
||||||
|
|
||||||
|
@ -1470,7 +1487,7 @@ Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson <hp@axis.se>
|
||||||
Fri Dec 18 17:50:18 1998 David Taylor <taylor@texas.cygnus.com>
|
Fri Dec 18 17:50:18 1998 David Taylor <taylor@texas.cygnus.com>
|
||||||
|
|
||||||
* cplus-dem.c (demangle_arm_pt): remove declaration -- function
|
* cplus-dem.c (demangle_arm_pt): remove declaration -- function
|
||||||
doesn't exist.
|
doesn't exist.
|
||||||
(do_hpacc_template_literal): remove unused variable `i'.
|
(do_hpacc_template_literal): remove unused variable `i'.
|
||||||
|
|
||||||
Fri Dec 18 16:11:43 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
|
Fri Dec 18 16:11:43 EST 1998 Andrew MacLeod <amacleod@cygnus.com>
|
||||||
|
@ -1514,48 +1531,48 @@ Fri Dec 4 13:51:04 1998 David Taylor <taylor@texas.cygnus.com>
|
||||||
* HP aCC demangling support.
|
* HP aCC demangling support.
|
||||||
* cplus-dem.c
|
* cplus-dem.c
|
||||||
(main): Remove default to HP style demangling, set to EDG
|
(main): Remove default to HP style demangling, set to EDG
|
||||||
demangling correctly when -edg specified; set the demangling style
|
demangling correctly when -edg specified; set the demangling style
|
||||||
when user specifies 'edg'. Set strip_underscore to
|
when user specifies 'edg'. Set strip_underscore to
|
||||||
prepends_underscore, if not HPUXHPPA. Set
|
prepends_underscore, if not HPUXHPPA. Set
|
||||||
current_demangling_style to hp_demangling if HPUXHPPA. Set
|
current_demangling_style to hp_demangling if HPUXHPPA. Set
|
||||||
current demangling style correctly if the switch is hp. Read
|
current demangling style correctly if the switch is hp. Read
|
||||||
label correctly also in the HP style case.
|
label correctly also in the HP style case.
|
||||||
(work_stuff): add temp_start field; add field for volatile member
|
(work_stuff): add temp_start field; add field for volatile member
|
||||||
function.
|
function.
|
||||||
(arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP
|
(arm_pt): handle ARM_DEMANGLING and EDG_DEMANGLING styles; HP
|
||||||
style for this case is the same as ARM.
|
style for this case is the same as ARM.
|
||||||
(demangle_args): handle EDG_DEMANGLING style; support HP style.
|
(demangle_args): handle EDG_DEMANGLING style; support HP style.
|
||||||
(demangle_arm_hp_template): new function. (It was
|
(demangle_arm_hp_template): new function. (It was
|
||||||
demangle_arm_pt.); check and set value of temp_start field in
|
demangle_arm_pt.); check and set value of temp_start field in
|
||||||
multiple places. Also, when ceching for end of template args,
|
multiple places. Also, when ceching for end of template args,
|
||||||
check to see if at end of static member of template class.
|
check to see if at end of static member of template class.
|
||||||
(demangle_class): new local variable : save_class_name_end Don't
|
(demangle_class): new local variable : save_class_name_end Don't
|
||||||
include template args in string defining class.
|
include template args in string defining class.
|
||||||
(demangle_class_name): use demangel_arm_hp_template.
|
(demangle_class_name): use demangel_arm_hp_template.
|
||||||
(demangle_function_name): handle case where demangling style is
|
(demangle_function_name): handle case where demangling style is
|
||||||
HP_DEMANGLING and currently point at an 'X' in the mangled name.
|
HP_DEMANGLING and currently point at an 'X' in the mangled name.
|
||||||
Handle EDG_DEMANGLING style. Handle constructor and destructor
|
Handle EDG_DEMANGLING style. Handle constructor and destructor
|
||||||
ops for HP style.
|
ops for HP style.
|
||||||
(demangle_prefix): handle EDG_DEMANGLING and ARM_DEMANGLING
|
(demangle_prefix): handle EDG_DEMANGLING and ARM_DEMANGLING
|
||||||
styles. global destructor and constructor for HP style are same
|
styles. global destructor and constructor for HP style are same
|
||||||
as for ARM style. Same for local variables.
|
as for ARM style. Same for local variables.
|
||||||
(demangle_qualified): handle EDG_DEMANGLING style.
|
(demangle_qualified): handle EDG_DEMANGLING style.
|
||||||
(demangle_signature): add case for volatile member function. For
|
(demangle_signature): add case for volatile member function. For
|
||||||
cases '1' - '9' : initialize the temp_start field to -1 and handle
|
cases '1' - '9' : initialize the temp_start field to -1 and handle
|
||||||
the EDG_DEMANGLING style. for case 'F' : handle EDG_DEMANGLING
|
the EDG_DEMANGLING style. for case 'F' : handle EDG_DEMANGLING
|
||||||
and AUTO_DEMANGLING styles. If expecting a function and managed
|
and AUTO_DEMANGLING styles. If expecting a function and managed
|
||||||
to demangle the funct args, then handle the LUCID_DEMANGLING,
|
to demangle the funct args, then handle the LUCID_DEMANGLING,
|
||||||
ARM_DEMANGLING, and EDG_DEMANGLING styles. Add case for local
|
ARM_DEMANGLING, and EDG_DEMANGLING styles. Add case for local
|
||||||
class name after "Lnnn_ in HP style case. HP style too needs to
|
class name after "Lnnn_ in HP style case. HP style too needs to
|
||||||
forget types. _nnn is OK for HP style, so don't report failure.
|
forget types. _nnn is OK for HP style, so don't report failure.
|
||||||
(do_hpacc_template_const_value): new function. Handle template's
|
(do_hpacc_template_const_value): new function. Handle template's
|
||||||
value param for HP/aCC.
|
value param for HP/aCC.
|
||||||
(do_hpacc_template_literal): new function. Handle a template's
|
(do_hpacc_template_literal): new function. Handle a template's
|
||||||
literal parameter for HP aCC.
|
literal parameter for HP aCC.
|
||||||
(recursively_demangle): new function
|
(recursively_demangle): new function
|
||||||
(snarf_numeric_literal): new function.
|
(snarf_numeric_literal): new function.
|
||||||
(usage): add 'edg' to the list of demangling styles; add hp switch
|
(usage): add 'edg' to the list of demangling styles; add hp switch
|
||||||
to message.
|
to message.
|
||||||
|
|
||||||
Sat Nov 28 17:25:22 1998 Christopher Faylor <cgf@cygnus.com>
|
Sat Nov 28 17:25:22 1998 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
@ -1637,13 +1654,13 @@ Mon Nov 2 15:05:33 1998 Geoffrey Noer <noer@cygnus.com>
|
||||||
Mon Nov 2 10:22:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
Mon Nov 2 10:22:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* pexecute.c: Check HAVE_CONFIG_H, not IN_GCC, when determining
|
* pexecute.c: Check HAVE_CONFIG_H, not IN_GCC, when determining
|
||||||
whether to include config.h. Possibly include unistd.h in the
|
whether to include config.h. Possibly include unistd.h in the
|
||||||
!IN_GCC case. Define VFORK_STRING as a printable function call
|
!IN_GCC case. Define VFORK_STRING as a printable function call
|
||||||
for error messages (either "vfork" or "fork".) If HAVE_VFORK_H is
|
for error messages (either "vfork" or "fork".) If HAVE_VFORK_H is
|
||||||
defined, include vfork.h. If VMS is defined, define vfork()
|
defined, include vfork.h. If VMS is defined, define vfork()
|
||||||
appropriately. Remove vfork check on USG, we're using autoconf.
|
appropriately. Remove vfork check on USG, we're using autoconf.
|
||||||
(pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking
|
(pexecute): Set `errmsg_fmt' to VFORK_STRING instead of checking
|
||||||
locally what string to use.
|
locally what string to use.
|
||||||
|
|
||||||
1998-10-26 Mark Mitchell <mark@markmitchell.com>
|
1998-10-26 Mark Mitchell <mark@markmitchell.com>
|
||||||
|
|
||||||
|
@ -1749,8 +1766,8 @@ Thu Oct 8 23:42:08 1998 Jeffrey A Law (law@cygnus.com)
|
||||||
Mon Sep 7 23:29:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
Mon Sep 7 23:29:01 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* mkstemp.c: Include config.h even when not IN_GCC. Wrap header
|
* mkstemp.c: Include config.h even when not IN_GCC. Wrap header
|
||||||
inclusions inside HAVE_*_H macros. Include ansidecl.h when not
|
inclusions inside HAVE_*_H macros. Include ansidecl.h when not
|
||||||
IN_GCC.
|
IN_GCC.
|
||||||
|
|
||||||
* vasprintf.c: Include stdarg.h/varargs.h first.
|
* vasprintf.c: Include stdarg.h/varargs.h first.
|
||||||
|
|
||||||
|
@ -2064,7 +2081,7 @@ Mon May 4 13:00:28 1998 Ian Lance Taylor <ian@cygnus.com>
|
||||||
* config/mh-sysv4 (RANLIB, INSTALL): Don't define.
|
* config/mh-sysv4 (RANLIB, INSTALL): Don't define.
|
||||||
* config.table: Change config_shell to CONFIG_SHELL, and use
|
* config.table: Change config_shell to CONFIG_SHELL, and use
|
||||||
libiberty_topdir to find move-if-change.
|
libiberty_topdir to find move-if-change.
|
||||||
(m68k-apollo-bsd*, m68k-apollo-sysv*): Remove.
|
(m68k-apollo-bsd*, m68k-apollo-sysv*): Remove.
|
||||||
(i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove.
|
(i[3456]86-ncr-sysv4*, *-*-dgux*, hppa*-hp-bsd*): Remove.
|
||||||
(*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove.
|
(*-*-irix*, *-*-m88kbcs*, *-*-sysv*): Remove.
|
||||||
* Makefile.in (srcdir): Set to @srcdir@.
|
* Makefile.in (srcdir): Set to @srcdir@.
|
||||||
|
@ -2281,7 +2298,7 @@ Wed Sep 24 00:31:59 1997 Felix Lee <flee@yin.cygnus.com>
|
||||||
|
|
||||||
* asprintf.c: stdarg.h when ALMOST_STDC
|
* asprintf.c: stdarg.h when ALMOST_STDC
|
||||||
* config/mh-windows (EXTRA_OFILES): add asprintf.o and
|
* config/mh-windows (EXTRA_OFILES): add asprintf.o and
|
||||||
strncasecmp.o.
|
strncasecmp.o.
|
||||||
|
|
||||||
Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
|
||||||
|
|
||||||
|
@ -4323,7 +4340,7 @@ Thu Jan 30 22:48:41 1992 Stu Grossman (grossman at cygnus.com)
|
||||||
|
|
||||||
Mon Jan 20 18:53:23 1992 Stu Grossman (grossman at cygnus.com)
|
Mon Jan 20 18:53:23 1992 Stu Grossman (grossman at cygnus.com)
|
||||||
|
|
||||||
* getopt.c, getopt1.c, ../include/getopt.h: Get latest versions.
|
* getopt.c, getopt1.c, ../include/getopt.h: Get latest versions.
|
||||||
|
|
||||||
Sat Jan 18 16:53:01 1992 Fred Fish (fnf at cygnus.com)
|
Sat Jan 18 16:53:01 1992 Fred Fish (fnf at cygnus.com)
|
||||||
|
|
||||||
|
|
|
@ -410,9 +410,6 @@ typedef char boolean;
|
||||||
static reg_errcode_t byte_regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
static reg_errcode_t byte_regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
||||||
reg_syntax_t syntax,
|
reg_syntax_t syntax,
|
||||||
struct re_pattern_buffer *bufp));
|
struct re_pattern_buffer *bufp));
|
||||||
static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
|
||||||
reg_syntax_t syntax,
|
|
||||||
struct re_pattern_buffer *bufp));
|
|
||||||
|
|
||||||
static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
||||||
const char *string1, int size1,
|
const char *string1, int size1,
|
||||||
|
@ -420,6 +417,19 @@ static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
||||||
int pos,
|
int pos,
|
||||||
struct re_registers *regs,
|
struct re_registers *regs,
|
||||||
int stop));
|
int stop));
|
||||||
|
static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
|
||||||
|
const char *string1, int size1,
|
||||||
|
const char *string2, int size2,
|
||||||
|
int startpos, int range,
|
||||||
|
struct re_registers *regs, int stop));
|
||||||
|
static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
|
||||||
|
|
||||||
|
#ifdef MBS_SUPPORT
|
||||||
|
static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
||||||
|
reg_syntax_t syntax,
|
||||||
|
struct re_pattern_buffer *bufp));
|
||||||
|
|
||||||
|
|
||||||
static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
||||||
const char *cstring1, int csize1,
|
const char *cstring1, int csize1,
|
||||||
const char *cstring2, int csize2,
|
const char *cstring2, int csize2,
|
||||||
|
@ -429,19 +439,13 @@ static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
||||||
wchar_t *string1, int size1,
|
wchar_t *string1, int size1,
|
||||||
wchar_t *string2, int size2,
|
wchar_t *string2, int size2,
|
||||||
int *mbs_offset1, int *mbs_offset2));
|
int *mbs_offset1, int *mbs_offset2));
|
||||||
static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
|
|
||||||
const char *string1, int size1,
|
|
||||||
const char *string2, int size2,
|
|
||||||
int startpos, int range,
|
|
||||||
struct re_registers *regs, int stop));
|
|
||||||
static int wcs_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
|
static int wcs_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
|
||||||
const char *string1, int size1,
|
const char *string1, int size1,
|
||||||
const char *string2, int size2,
|
const char *string2, int size2,
|
||||||
int startpos, int range,
|
int startpos, int range,
|
||||||
struct re_registers *regs, int stop));
|
struct re_registers *regs, int stop));
|
||||||
static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
|
|
||||||
static int wcs_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
|
static int wcs_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* These are the command codes that appear in compiled regular
|
/* These are the command codes that appear in compiled regular
|
||||||
expressions. Some opcodes are followed by argument bytes. A
|
expressions. Some opcodes are followed by argument bytes. A
|
||||||
|
@ -611,29 +615,31 @@ typedef enum
|
||||||
# define PREFIX(name) byte_##name
|
# define PREFIX(name) byte_##name
|
||||||
# define ARG_PREFIX(name) name
|
# define ARG_PREFIX(name) name
|
||||||
# define PUT_CHAR(c) putchar (c)
|
# define PUT_CHAR(c) putchar (c)
|
||||||
#elif defined WCHAR
|
|
||||||
# define CHAR_T wchar_t
|
|
||||||
# define UCHAR_T wchar_t
|
|
||||||
# define COMPILED_BUFFER_VAR wc_buffer
|
|
||||||
# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
|
|
||||||
# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
|
|
||||||
# define PREFIX(name) wcs_##name
|
|
||||||
# define ARG_PREFIX(name) c##name
|
|
||||||
/* Should we use wide stream?? */
|
|
||||||
# define PUT_CHAR(c) printf ("%C", c);
|
|
||||||
# define TRUE 1
|
|
||||||
# define FALSE 0
|
|
||||||
#else
|
#else
|
||||||
# ifdef MBS_SUPPORT
|
# ifdef WCHAR
|
||||||
# define WCHAR
|
# define CHAR_T wchar_t
|
||||||
|
# define UCHAR_T wchar_t
|
||||||
|
# define COMPILED_BUFFER_VAR wc_buffer
|
||||||
|
# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
|
||||||
|
# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
|
||||||
|
# define PREFIX(name) wcs_##name
|
||||||
|
# define ARG_PREFIX(name) c##name
|
||||||
|
/* Should we use wide stream?? */
|
||||||
|
# define PUT_CHAR(c) printf ("%C", c);
|
||||||
|
# define TRUE 1
|
||||||
|
# define FALSE 0
|
||||||
|
# else
|
||||||
|
# ifdef MBS_SUPPORT
|
||||||
|
# define WCHAR
|
||||||
|
# define INSIDE_RECURSION
|
||||||
|
# include "regex.c"
|
||||||
|
# undef INSIDE_RECURSION
|
||||||
|
# endif
|
||||||
|
# define BYTE
|
||||||
# define INSIDE_RECURSION
|
# define INSIDE_RECURSION
|
||||||
# include "regex.c"
|
# include "regex.c"
|
||||||
# undef INSIDE_RECURSION
|
# undef INSIDE_RECURSION
|
||||||
# endif
|
# endif
|
||||||
# define BYTE
|
|
||||||
# define INSIDE_RECURSION
|
|
||||||
# include "regex.c"
|
|
||||||
# undef INSIDE_RECURSION
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INSIDE_RECURSION
|
#ifdef INSIDE_RECURSION
|
||||||
|
@ -5076,16 +5082,35 @@ weak_alias (__re_search_2, re_search_2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WCHAR
|
#ifdef WCHAR
|
||||||
# define FREE_WCS_BUFFERS() \
|
# define MAX_ALLOCA_SIZE 2000
|
||||||
do { \
|
|
||||||
FREE_VAR (string1); \
|
# define FREE_WCS_BUFFERS() \
|
||||||
FREE_VAR (string2); \
|
do { \
|
||||||
FREE_VAR (mbs_offset1); \
|
if (size1 > MAX_ALLOCA_SIZE) \
|
||||||
FREE_VAR (mbs_offset2); \
|
{ \
|
||||||
|
free (wcs_string1); \
|
||||||
|
free (mbs_offset1); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
FREE_VAR (wcs_string1); \
|
||||||
|
FREE_VAR (mbs_offset1); \
|
||||||
|
} \
|
||||||
|
if (size2 > MAX_ALLOCA_SIZE) \
|
||||||
|
{ \
|
||||||
|
free (wcs_string2); \
|
||||||
|
free (mbs_offset2); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
FREE_VAR (wcs_string2); \
|
||||||
|
FREE_VAR (mbs_offset2); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range,
|
PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range,
|
||||||
regs, stop)
|
regs, stop)
|
||||||
|
@ -5160,36 +5185,72 @@ PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range,
|
||||||
fill them with converted string. */
|
fill them with converted string. */
|
||||||
if (size1 != 0)
|
if (size1 != 0)
|
||||||
{
|
{
|
||||||
wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
|
if (size1 > MAX_ALLOCA_SIZE)
|
||||||
mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
|
{
|
||||||
is_binary = REGEX_TALLOC (size1 + 1, char);
|
wcs_string1 = TALLOC (size1 + 1, CHAR_T);
|
||||||
|
mbs_offset1 = TALLOC (size1 + 1, int);
|
||||||
|
is_binary = TALLOC (size1 + 1, char);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
|
||||||
|
mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
|
||||||
|
is_binary = REGEX_TALLOC (size1 + 1, char);
|
||||||
|
}
|
||||||
if (!wcs_string1 || !mbs_offset1 || !is_binary)
|
if (!wcs_string1 || !mbs_offset1 || !is_binary)
|
||||||
{
|
{
|
||||||
FREE_VAR (wcs_string1);
|
if (size1 > MAX_ALLOCA_SIZE)
|
||||||
FREE_VAR (mbs_offset1);
|
{
|
||||||
FREE_VAR (is_binary);
|
free (wcs_string1);
|
||||||
|
free (mbs_offset1);
|
||||||
|
free (is_binary);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FREE_VAR (wcs_string1);
|
||||||
|
FREE_VAR (mbs_offset1);
|
||||||
|
FREE_VAR (is_binary);
|
||||||
|
}
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
|
wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
|
||||||
mbs_offset1, is_binary);
|
mbs_offset1, is_binary);
|
||||||
wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
|
wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
|
||||||
FREE_VAR (is_binary);
|
if (size1 > MAX_ALLOCA_SIZE)
|
||||||
|
free (is_binary);
|
||||||
|
else
|
||||||
|
FREE_VAR (is_binary);
|
||||||
}
|
}
|
||||||
if (size2 != 0)
|
if (size2 != 0)
|
||||||
{
|
{
|
||||||
wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
|
if (size2 > MAX_ALLOCA_SIZE)
|
||||||
mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
|
{
|
||||||
is_binary = REGEX_TALLOC (size2 + 1, char);
|
wcs_string2 = TALLOC (size2 + 1, CHAR_T);
|
||||||
|
mbs_offset2 = TALLOC (size2 + 1, int);
|
||||||
|
is_binary = TALLOC (size2 + 1, char);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
|
||||||
|
mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
|
||||||
|
is_binary = REGEX_TALLOC (size2 + 1, char);
|
||||||
|
}
|
||||||
if (!wcs_string2 || !mbs_offset2 || !is_binary)
|
if (!wcs_string2 || !mbs_offset2 || !is_binary)
|
||||||
{
|
{
|
||||||
FREE_WCS_BUFFERS ();
|
FREE_WCS_BUFFERS ();
|
||||||
FREE_VAR (is_binary);
|
if (size2 > MAX_ALLOCA_SIZE)
|
||||||
|
free (is_binary);
|
||||||
|
else
|
||||||
|
FREE_VAR (is_binary);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
|
wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
|
||||||
mbs_offset2, is_binary);
|
mbs_offset2, is_binary);
|
||||||
wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
|
wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
|
||||||
FREE_VAR (is_binary);
|
if (size2 > MAX_ALLOCA_SIZE)
|
||||||
|
free (is_binary);
|
||||||
|
else
|
||||||
|
FREE_VAR (is_binary);
|
||||||
}
|
}
|
||||||
#endif /* WCHAR */
|
#endif /* WCHAR */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue