summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-05-14 18:15:18 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-05-16 13:09:17 +0000
commit9674d46a132a274aad55231acfd004cbf1e42f04 (patch)
tree7f1d2c433fd7864686a24afa9bfb7686bab2a012 /regcomp.c
parentd0e36aa98afbfc3010e3967466f74fb90a5f87db (diff)
downloadperl-9674d46a132a274aad55231acfd004cbf1e42f04.tar.gz
refactoring out S_regoptail
Message-ID: <20060515041518.GA15745@petdance.com> p4raw-id: //depot/perl@28205
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/regcomp.c b/regcomp.c
index 9dc539578d..8ca5ccabc8 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3543,10 +3543,16 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp)
}
regtail(pRExC_state, lastbr, ender);
- if (have_branch) {
+ if (have_branch && !SIZE_ONLY) {
/* Hook the tails of the branches to the closing node. */
- for (br = ret; br != NULL; br = regnext(br)) {
- regoptail(pRExC_state, br, ender);
+ for (br = ret; br; br = regnext(br)) {
+ const U8 op = PL_regkind[OP(br)];
+ if (op == BRANCH) {
+ regtail(pRExC_state, NEXTOPER(br), ender);
+ }
+ else if (op == BRANCHJ) {
+ regtail(pRExC_state, NEXTOPER(NEXTOPER(br)), ender);
+ }
}
}
}
@@ -5598,27 +5604,6 @@ S_regtail(pTHX_ const RExC_state_t *pRExC_state, regnode *p, const regnode *val)
}
/*
-- regoptail - regtail on operand of first argument; nop if operandless
-*/
-/* TODO: All three parms should be const */
-STATIC void
-S_regoptail(pTHX_ const RExC_state_t *pRExC_state, regnode *p, const regnode *val)
-{
- dVAR;
- /* "Operandless" and "op != BRANCH" are synonymous in practice. */
- if (p == NULL || SIZE_ONLY)
- return;
- if (PL_regkind[(U8)OP(p)] == BRANCH) {
- regtail(pRExC_state, NEXTOPER(p), val);
- }
- else if ( PL_regkind[(U8)OP(p)] == BRANCHJ) {
- regtail(pRExC_state, NEXTOPER(NEXTOPER(p)), val);
- }
- else
- return;
-}
-
-/*
- regcurly - a little FSA that accepts {\d+,?\d*}
*/
STATIC I32