summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-01-15 20:31:14 +0100
committerYves Orton <demerphq@gmail.com>2023-03-13 21:26:08 +0800
commitd78630f1ec4da716988da18d97cb6425388e696c (patch)
tree6ef6a501ea3219d2f493179de78e930b09ce2763 /regcomp.c
parent17e3e02ad120eabda2bdb6c297a70d53294437ef (diff)
downloadperl-d78630f1ec4da716988da18d97cb6425388e696c.tar.gz
regcomp.c - extend REF to hold the paren it needs to regcppush
this way we can avoid pushing every buffer, we only need to push the nestroot of the ref.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/regcomp.c b/regcomp.c
index da8b3e32f1..94428fad9c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2754,7 +2754,7 @@ S_handle_named_backref(pTHX_ RExC_state_t *pRExC_state,
SvREFCNT_inc_simple_void_NN(sv_dat);
}
RExC_sawback = 1;
- ret = reg1node(pRExC_state,
+ ret = reg2node(pRExC_state,
((! FOLD)
? REFN
: (ASCII_FOLD_RESTRICTED)
@@ -2764,7 +2764,9 @@ S_handle_named_backref(pTHX_ RExC_state_t *pRExC_state,
: (LOC)
? REFFLN
: REFFN),
- num);
+ num, RExC_nestroot);
+ if (RExC_nestroot && num >= (U32)RExC_nestroot)
+ REGNODE_p(ret)->flags = VOLATILE_REF;
*flagp |= HASWIDTH;
nextchar(pRExC_state);
@@ -6028,7 +6030,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
}
}
RExC_sawback = 1;
- ret = reg1node(pRExC_state,
+ ret = reg2node(pRExC_state,
((! FOLD)
? REF
: (ASCII_FOLD_RESTRICTED)
@@ -6038,7 +6040,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
: (LOC)
? REFFL
: REFF),
- num);
+ num, RExC_nestroot);
if (RExC_nestroot && num >= RExC_nestroot)
REGNODE_p(ret)->flags = VOLATILE_REF;
if (OP(REGNODE_p(ret)) == REFF) {