From: Vincent Pit Date: Sun, 23 Sep 2012 20:56:09 +0000 (+0200) Subject: Fix infinite recursion with perl 5.17.[12] X-Git-Tag: v0.03~6 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=f609ee10b4b981c6c131936a39d13108d608a4fc;p=perl%2Fmodules%2Fre-engine-Hooks.git Fix infinite recursion with perl 5.17.[12] This is solved by setting the new op_comp member of the regexp engine struct. We also replace PL_core_reg_engine by our own regexp engine. --- diff --git a/Hooks.xs b/Hooks.xs index 99e81d3..0320d2a 100644 --- a/Hooks.xs +++ b/Hooks.xs @@ -143,8 +143,9 @@ EXTERN_C SV * reh_reg_qr_package(pTHX_ REGEXP * const); EXTERN_C void * reh_regdupe(pTHX_ REGEXP * const, CLONE_PARAMS *); EXTERN_C void * reh_re_dupe(pTHX_ REGEXP * const, CLONE_PARAMS *); #endif - -EXTERN_C const struct regexp_engine reh_regexp_engine; +#if REH_HAS_PERL(5, 17, 1) +EXTERN_C REGEXP *reh_op_compile(pTHX_ SV ** const patternp, int pat_count, OP *expr, const regexp_engine* eng, REGEXP *VOL old_re, bool *is_bare_re, U32 orig_rx_flags, U32 pm_flags); +#endif const struct regexp_engine reh_regexp_engine = { reh_regcomp, @@ -157,9 +158,12 @@ const struct regexp_engine reh_regexp_engine = { reh_reg_numbered_buff_length, reh_reg_named_buff, reh_reg_named_buff_iter, - reh_reg_qr_package, + reh_reg_qr_package #if defined(USE_ITHREADS) - reh_re_dupe + , reh_re_dupe +#endif +#if REH_HAS_PERL(5, 17, 1) + , reh_op_compile #endif }; diff --git a/re_defs.h b/re_defs.h index cf2eb14..d51eeb8 100644 --- a/re_defs.h +++ b/re_defs.h @@ -1,3 +1,5 @@ +EXTERN_C const struct regexp_engine reh_regexp_engine; + EXTERN_C void reh_call_comp_begin_hook(pTHX_ regexp *); EXTERN_C void reh_call_comp_node_hook(pTHX_ regexp *, regnode *); EXTERN_C void reh_call_exec_node_hook(pTHX_ regexp *, regnode *, regmatch_info *, regmatch_state *); diff --git a/src/5010001/regcomp.c b/src/5010001/regcomp.c index d6bfde6..f8d3591 100644 --- a/src/5010001/regcomp.c +++ b/src/5010001/regcomp.c @@ -4161,7 +4161,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5011000/regcomp.c b/src/5011000/regcomp.c index b17c71b..53c8ba1 100644 --- a/src/5011000/regcomp.c +++ b/src/5011000/regcomp.c @@ -4163,7 +4163,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5011001/regcomp.c b/src/5011001/regcomp.c index b68a456..0e3f8a0 100644 --- a/src/5011001/regcomp.c +++ b/src/5011001/regcomp.c @@ -4173,7 +4173,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5011002/regcomp.c b/src/5011002/regcomp.c index 683a7c4..3e7be43 100644 --- a/src/5011002/regcomp.c +++ b/src/5011002/regcomp.c @@ -4178,7 +4178,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5011003/regcomp.c b/src/5011003/regcomp.c index 1f9c84f..bffbdc1 100644 --- a/src/5011003/regcomp.c +++ b/src/5011003/regcomp.c @@ -4178,7 +4178,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5011004/regcomp.c b/src/5011004/regcomp.c index 1f9c84f..bffbdc1 100644 --- a/src/5011004/regcomp.c +++ b/src/5011004/regcomp.c @@ -4178,7 +4178,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5011005/regcomp.c b/src/5011005/regcomp.c index fa4caf6..8805b2f 100644 --- a/src/5011005/regcomp.c +++ b/src/5011005/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5012000/regcomp.c b/src/5012000/regcomp.c index 1053849..3dfd2df 100644 --- a/src/5012000/regcomp.c +++ b/src/5012000/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5012001/regcomp.c b/src/5012001/regcomp.c index 2d4110b..051dac6 100644 --- a/src/5012001/regcomp.c +++ b/src/5012001/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5012002/regcomp.c b/src/5012002/regcomp.c index 2d4110b..051dac6 100644 --- a/src/5012002/regcomp.c +++ b/src/5012002/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5012003/regcomp.c b/src/5012003/regcomp.c index 2d4110b..051dac6 100644 --- a/src/5012003/regcomp.c +++ b/src/5012003/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5012004/regcomp.c b/src/5012004/regcomp.c index 2d4110b..051dac6 100644 --- a/src/5012004/regcomp.c +++ b/src/5012004/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013000/regcomp.c b/src/5013000/regcomp.c index 1053849..3dfd2df 100644 --- a/src/5013000/regcomp.c +++ b/src/5013000/regcomp.c @@ -4176,7 +4176,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013001/regcomp.c b/src/5013001/regcomp.c index 7b11f74..71efa0a 100644 --- a/src/5013001/regcomp.c +++ b/src/5013001/regcomp.c @@ -4224,7 +4224,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013002/regcomp.c b/src/5013002/regcomp.c index 92917f7..799b227 100644 --- a/src/5013002/regcomp.c +++ b/src/5013002/regcomp.c @@ -4224,7 +4224,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013003/regcomp.c b/src/5013003/regcomp.c index 4c60123..bfde505 100644 --- a/src/5013003/regcomp.c +++ b/src/5013003/regcomp.c @@ -4224,7 +4224,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013004/regcomp.c b/src/5013004/regcomp.c index 34b7188..64ca204 100644 --- a/src/5013004/regcomp.c +++ b/src/5013004/regcomp.c @@ -4222,7 +4222,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013005/regcomp.c b/src/5013005/regcomp.c index cd00b96..d495af6 100644 --- a/src/5013005/regcomp.c +++ b/src/5013005/regcomp.c @@ -4230,7 +4230,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013006/regcomp.c b/src/5013006/regcomp.c index ed96849..f6a2524 100644 --- a/src/5013006/regcomp.c +++ b/src/5013006/regcomp.c @@ -4296,7 +4296,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013007/regcomp.c b/src/5013007/regcomp.c index 2c9c953..102c661 100644 --- a/src/5013007/regcomp.c +++ b/src/5013007/regcomp.c @@ -4309,7 +4309,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013008/regcomp.c b/src/5013008/regcomp.c index 794a89c..220dd02 100644 --- a/src/5013008/regcomp.c +++ b/src/5013008/regcomp.c @@ -4347,7 +4347,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013009/regcomp.c b/src/5013009/regcomp.c index 835cfd5..7ff1f08 100644 --- a/src/5013009/regcomp.c +++ b/src/5013009/regcomp.c @@ -4322,7 +4322,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013010/regcomp.c b/src/5013010/regcomp.c index cef1124..2c5e879 100644 --- a/src/5013010/regcomp.c +++ b/src/5013010/regcomp.c @@ -4359,7 +4359,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5013011/regcomp.c b/src/5013011/regcomp.c index 53d4a40..310bb6a 100644 --- a/src/5013011/regcomp.c +++ b/src/5013011/regcomp.c @@ -4461,7 +4461,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5014000/regcomp.c b/src/5014000/regcomp.c index 36f88ad..88aed26 100644 --- a/src/5014000/regcomp.c +++ b/src/5014000/regcomp.c @@ -4486,7 +4486,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5014001/regcomp.c b/src/5014001/regcomp.c index a5ac553..71d0e33 100644 --- a/src/5014001/regcomp.c +++ b/src/5014001/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5014002/regcomp.c b/src/5014002/regcomp.c index a5ac553..71d0e33 100644 --- a/src/5014002/regcomp.c +++ b/src/5014002/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015000/regcomp.c b/src/5015000/regcomp.c index 382b1e1..2fdc923 100644 --- a/src/5015000/regcomp.c +++ b/src/5015000/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015001/regcomp.c b/src/5015001/regcomp.c index 9ca75cb..fc1ddb3 100644 --- a/src/5015001/regcomp.c +++ b/src/5015001/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015002/regcomp.c b/src/5015002/regcomp.c index 4ada8eb..9da1ca9 100644 --- a/src/5015002/regcomp.c +++ b/src/5015002/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015003/regcomp.c b/src/5015003/regcomp.c index 4ada8eb..9da1ca9 100644 --- a/src/5015003/regcomp.c +++ b/src/5015003/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015004/regcomp.c b/src/5015004/regcomp.c index 1e762f9..d3b7a58 100644 --- a/src/5015004/regcomp.c +++ b/src/5015004/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015005/regcomp.c b/src/5015005/regcomp.c index 3e4ca33..304e9a0 100644 --- a/src/5015005/regcomp.c +++ b/src/5015005/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015006/regcomp.c b/src/5015006/regcomp.c index a244145..03cf08a 100644 --- a/src/5015006/regcomp.c +++ b/src/5015006/regcomp.c @@ -4483,7 +4483,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015007/regcomp.c b/src/5015007/regcomp.c index 6a0b96d..e27213c 100644 --- a/src/5015007/regcomp.c +++ b/src/5015007/regcomp.c @@ -4743,7 +4743,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015008/regcomp.c b/src/5015008/regcomp.c index a16bf69..1737ba4 100644 --- a/src/5015008/regcomp.c +++ b/src/5015008/regcomp.c @@ -4746,7 +4746,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5015009/regcomp.c b/src/5015009/regcomp.c index 59c12e0..abeb9da 100644 --- a/src/5015009/regcomp.c +++ b/src/5015009/regcomp.c @@ -4830,7 +4830,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5016000/regcomp.c b/src/5016000/regcomp.c index 2b80f68..f76c11b 100644 --- a/src/5016000/regcomp.c +++ b/src/5016000/regcomp.c @@ -4830,7 +4830,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5016001/regcomp.c b/src/5016001/regcomp.c index 2b80f68..f76c11b 100644 --- a/src/5016001/regcomp.c +++ b/src/5016001/regcomp.c @@ -4830,7 +4830,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5017000/regcomp.c b/src/5017000/regcomp.c index 2fc6645..7644799 100644 --- a/src/5017000/regcomp.c +++ b/src/5017000/regcomp.c @@ -4833,7 +4833,7 @@ Perl_reginitcolors(pTHX) #ifndef PERL_IN_XSUB_RE -#define RE_ENGINE_PTR &PL_core_reg_engine +#define RE_ENGINE_PTR &reh_regexp_engine #else extern const struct regexp_engine my_reg_engine; #define RE_ENGINE_PTR &my_reg_engine diff --git a/src/5017001/regcomp.c b/src/5017001/regcomp.c index bfc83be..d61977e 100644 --- a/src/5017001/regcomp.c +++ b/src/5017001/regcomp.c @@ -4914,19 +4914,19 @@ Perl_current_re_engine(pTHX) SV **ptr; if (!table) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = hv_fetchs(table, "regcomp", FALSE); if ( !(ptr && SvIOK(*ptr) && SvIV(*ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(*ptr)); } else { SV *ptr; if (!PL_curcop->cop_hints_hash) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = cop_hints_fetch_pvs(PL_curcop, "regcomp", 0); if ( !(ptr && SvIOK(ptr) && SvIV(ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(ptr)); } } diff --git a/src/5017002/regcomp.c b/src/5017002/regcomp.c index 5edf0fd..aa43f81 100644 --- a/src/5017002/regcomp.c +++ b/src/5017002/regcomp.c @@ -4922,19 +4922,19 @@ Perl_current_re_engine(pTHX) SV **ptr; if (!table) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = hv_fetchs(table, "regcomp", FALSE); if ( !(ptr && SvIOK(*ptr) && SvIV(*ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(*ptr)); } else { SV *ptr; if (!PL_curcop->cop_hints_hash) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = cop_hints_fetch_pvs(PL_curcop, "regcomp", 0); if ( !(ptr && SvIOK(ptr) && SvIV(ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(ptr)); } } diff --git a/src/5017003/regcomp.c b/src/5017003/regcomp.c index 0ffc3a2..113e943 100644 --- a/src/5017003/regcomp.c +++ b/src/5017003/regcomp.c @@ -4929,19 +4929,19 @@ Perl_current_re_engine(pTHX) SV **ptr; if (!table) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = hv_fetchs(table, "regcomp", FALSE); if ( !(ptr && SvIOK(*ptr) && SvIV(*ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(*ptr)); } else { SV *ptr; if (!PL_curcop->cop_hints_hash) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = cop_hints_fetch_pvs(PL_curcop, "regcomp", 0); if ( !(ptr && SvIOK(ptr) && SvIV(ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(ptr)); } } @@ -4979,7 +4979,7 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 rx_flags) #ifdef PERL_IN_XSUB_RE &my_reg_engine, #else - &PL_core_reg_engine, + &reh_regexp_engine, #endif NULL, NULL, rx_flags, 0); } diff --git a/src/5017004/regcomp.c b/src/5017004/regcomp.c index 4049b40..217f8fe 100644 --- a/src/5017004/regcomp.c +++ b/src/5017004/regcomp.c @@ -4928,19 +4928,19 @@ Perl_current_re_engine(pTHX) SV **ptr; if (!table) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = hv_fetchs(table, "regcomp", FALSE); if ( !(ptr && SvIOK(*ptr) && SvIV(*ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(*ptr)); } else { SV *ptr; if (!PL_curcop->cop_hints_hash) - return &PL_core_reg_engine; + return &reh_regexp_engine; ptr = cop_hints_fetch_pvs(PL_curcop, "regcomp", 0); if ( !(ptr && SvIOK(ptr) && SvIV(ptr))) - return &PL_core_reg_engine; + return &reh_regexp_engine; return INT2PTR(regexp_engine*,SvIV(ptr)); } } @@ -4978,7 +4978,7 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 rx_flags) #ifdef PERL_IN_XSUB_RE &my_reg_engine, #else - &PL_core_reg_engine, + &reh_regexp_engine, #endif NULL, NULL, rx_flags, 0); } diff --git a/src/update.pl b/src/update.pl index 97a60b6..e7fe628 100644 --- a/src/update.pl +++ b/src/update.pl @@ -246,6 +246,9 @@ sub patch_regcomp { } elsif ($line =~ /end node insert/) { push @{$patched_chunks{$file}}, 'COMP_NODE_HOOK'; return $line, " REH_CALL_COMP_NODE_HOOK(pRExC_state->rx, convert);\n"; + } elsif ($line =~ /&PL_core_reg_engine/) { + $line =~ s/&PL_core_reg_engine\b/&reh_regexp_engine/g; + return $line; } return $line;