diff options
-rw-r--r-- | embed.fnc | 1 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | ext/re/re.xs | 2 | ||||
-rw-r--r-- | ext/re/re_top.h | 1 | ||||
-rw-r--r-- | global.sym | 1 | ||||
-rw-r--r-- | perl.h | 2 | ||||
-rw-r--r-- | pp_hot.c | 9 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | regcomp.c | 6 | ||||
-rw-r--r-- | regcomp.h | 3 | ||||
-rw-r--r-- | regexp.h | 1 |
11 files changed, 26 insertions, 5 deletions
@@ -696,6 +696,7 @@ ApR |regnode*|regnext |NN regnode* p EXp |SV*|reg_named_buff_get |NN const REGEXP * const rx|NN SV* namesv|U32 flags EXp |SV*|reg_numbered_buff_get|NN const REGEXP * const rx|I32 paren|NULLOK SV* usesv +EXp |SV*|reg_qr_pkg|NN const REGEXP * const rx Ep |void |regprop |NULLOK const regexp *prog|NN SV* sv|NN const regnode* o Ap |void |repeatcpy |NN char* to|NN const char* from|I32 len|I32 count @@ -706,6 +706,7 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define reg_named_buff_get Perl_reg_named_buff_get #define reg_numbered_buff_get Perl_reg_numbered_buff_get +#define reg_qr_pkg Perl_reg_qr_pkg #endif #if defined(PERL_CORE) || defined(PERL_EXT) #define regprop Perl_regprop @@ -2949,6 +2950,7 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define reg_named_buff_get(a,b,c) Perl_reg_named_buff_get(aTHX_ a,b,c) #define reg_numbered_buff_get(a,b,c) Perl_reg_numbered_buff_get(aTHX_ a,b,c) +#define reg_qr_pkg(a) Perl_reg_qr_pkg(aTHX_ a) #endif #if defined(PERL_CORE) || defined(PERL_EXT) #define regprop(a,b,c) Perl_regprop(aTHX_ a,b,c) diff --git a/ext/re/re.xs b/ext/re/re.xs index 5ab5f7c095..aa87bb688c 100644 --- a/ext/re/re.xs +++ b/ext/re/re.xs @@ -24,6 +24,7 @@ extern SV* my_re_intuit_string (pTHX_ regexp *prog); extern void my_regfree (pTHX_ struct regexp* r); extern SV* my_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv); extern SV* my_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags); +extern SV* my_reg_qr_pkg(pTHX_ const REGEXP * const rx); #if defined(USE_ITHREADS) extern void* my_regdupe (pTHX_ const regexp *r, CLONE_PARAMS *param); #endif @@ -40,6 +41,7 @@ const struct regexp_engine my_reg_engine = { my_regfree, my_reg_numbered_buff_get, my_reg_named_buff_get, + my_reg_qr_pkg, #if defined(USE_ITHREADS) my_regdupe #endif diff --git a/ext/re/re_top.h b/ext/re/re_top.h index 7f53a74631..39e02768de 100644 --- a/ext/re/re_top.h +++ b/ext/re/re_top.h @@ -18,6 +18,7 @@ #define Perl_regdupe_internal my_regdupe #define Perl_reg_numbered_buff_get my_reg_numbered_buff_get #define Perl_reg_named_buff_get my_reg_named_buff_get +#define Perl_reg_qr_pkg my_reg_qr_pkg #define PERL_NO_GET_CONTEXT diff --git a/global.sym b/global.sym index 3ac17bc029..57405d0791 100644 --- a/global.sym +++ b/global.sym @@ -407,6 +407,7 @@ Perl_regexec_flags Perl_regnext Perl_reg_named_buff_get Perl_reg_numbered_buff_get +Perl_reg_qr_pkg Perl_repeatcpy Perl_rninstr Perl_rsignal @@ -225,6 +225,8 @@ #define CALLREG_NAMEDBUF(rx,name,flags) \ CALL_FPTR((rx)->engine->named_buff_get)(aTHX_ (rx),(name),(flags)) +#define CALLREG_QRPKG(rx) \ + CALL_FPTR((rx)->engine->qr_pkg)(aTHX_ (rx)) #if defined(USE_ITHREADS) #define CALLREGDUPE(prog,param) \ @@ -1178,12 +1178,13 @@ PP(pp_qr) { dVAR; dSP; register PMOP * const pm = cPMOP; + REGEXP * rx = PM_GETRE(pm); + SV * const pkg = CALLREG_QRPKG(rx); SV * const rv = sv_newmortal(); - SV * const sv = newSVrv(rv, "Regexp"); - regexp *re = PM_GETRE(pm); - if (re->extflags & RXf_TAINTED) + SV * const sv = newSVrv(rv, SvPV_nolen(pkg)); + if (rx->extflags & RXf_TAINTED) SvTAINTED_on(rv); - sv_magic(sv,(SV*)ReREFCNT_inc(re), PERL_MAGIC_qr,0,0); + sv_magic(sv,(SV*)ReREFCNT_inc(rx), PERL_MAGIC_qr,0,0); XPUSHs(rv); RETURN; } @@ -1902,6 +1902,9 @@ PERL_CALLCONV SV* Perl_reg_named_buff_get(pTHX_ const REGEXP * const rx, SV* nam PERL_CALLCONV SV* Perl_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv) __attribute__nonnull__(pTHX_1); +PERL_CALLCONV SV* Perl_reg_qr_pkg(pTHX_ const REGEXP * const rx) + __attribute__nonnull__(pTHX_1); + PERL_CALLCONV void Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* o) __attribute__nonnull__(pTHX_2) @@ -4836,6 +4836,12 @@ Perl_reg_numbered_buff_get(pTHX_ const REGEXP * const rx, I32 paren, SV* usesv) return sv; } +SV* +Perl_reg_qr_pkg(pTHX_ const REGEXP * const rx) +{ + PERL_UNUSED_ARG(rx); + return newSVpvs("Regexp"); +} /* Scans the name of a named buffer from the pattern. * If flags is REG_RSN_RETURN_NULL returns null. @@ -453,13 +453,14 @@ EXTCONST U8 PL_simple[] = { EXTCONST regexp_engine PL_core_reg_engine; #else /* DOINIT */ EXTCONST regexp_engine PL_core_reg_engine = { - Perl_re_compile, + Perl_re_compile, Perl_regexec_flags, Perl_re_intuit_start, Perl_re_intuit_string, Perl_regfree_internal, Perl_reg_numbered_buff_get, Perl_reg_named_buff_get, + Perl_reg_qr_pkg, #if defined(USE_ITHREADS) Perl_regdupe_internal #endif @@ -123,6 +123,7 @@ typedef struct regexp_engine { void (*free) (pTHX_ struct regexp* r); SV* (*numbered_buff_get) (pTHX_ const REGEXP * const rx, I32 paren, SV* usesv); SV* (*named_buff_get)(pTHX_ const REGEXP * const rx, SV* namesv, U32 flags); + SV* (*qr_pkg)(pTHX_ const REGEXP * const rx); #ifdef USE_ITHREADS void* (*dupe) (pTHX_ const regexp *r, CLONE_PARAMS *param); #endif |