Es |regnode*|reg_node |NN struct RExC_state_t *state|U8 op
Es |regnode*|regpiece |NN struct RExC_state_t *state|NN I32 *flagp
Es |void |reginsert |NN struct RExC_state_t *state|U8 op|NN regnode *opnd
-Es |void |regoptail |NN const struct RExC_state_t *state|NN regnode *p|NN const regnode *val
Es |void |regtail |NN const struct RExC_state_t *state|NN regnode *p|NN const regnode *val
EsRn |char* |regwhite |NN char *p|NN const char *e
Es |char* |nextchar |NN struct RExC_state_t *state
#define reg_node S_reg_node
#define regpiece S_regpiece
#define reginsert S_reginsert
-#define regoptail S_regoptail
#define regtail S_regtail
#define regwhite S_regwhite
#define nextchar S_nextchar
#define reg_node(a,b) S_reg_node(aTHX_ a,b)
#define regpiece(a,b) S_regpiece(aTHX_ a,b)
#define reginsert(a,b,c) S_reginsert(aTHX_ a,b,c)
-#define regoptail(a,b,c) S_regoptail(aTHX_ a,b,c)
#define regtail(a,b,c) S_regtail(aTHX_ a,b,c)
#define regwhite S_regwhite
#define nextchar(a) S_nextchar(aTHX_ a)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
-STATIC void S_regoptail(pTHX_ const struct RExC_state_t *state, regnode *p, const regnode *val)
- __attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2)
- __attribute__nonnull__(pTHX_3);
-
STATIC void S_regtail(pTHX_ const struct RExC_state_t *state, regnode *p, const regnode *val)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
}
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);
+ }
}
}
}
}
/*
-- 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