summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c40
-rw-r--r--regcomp.h7
-rw-r--r--reginline.h2
3 files changed, 25 insertions, 24 deletions
diff --git a/regcomp.c b/regcomp.c
index a8bf8d5a91..17fa3b789c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3876,7 +3876,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch,
DEBUG_r({
optimize = convert
+ NODE_STEP_REGNODE
- + PL_regnode_arg_len[ OP( convert ) ];
+ + REGNODE_ARG_LEN( OP( convert ) );
});
/* XXX We really should free up the resource in trie now,
as we won't use them - (which resources?) dmq */
@@ -13348,7 +13348,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
reginsert(pRExC_state, OPFAIL, orig_emit, depth+1);
ckWARNreg(RExC_parse, "Quantifier {n,m} with n > m can't match");
NEXT_OFF(REGNODE_p(orig_emit)) =
- PL_regnode_arg_len[OPFAIL] + NODE_STEP_REGNODE;
+ REGNODE_ARG_LEN(OPFAIL) + NODE_STEP_REGNODE;
return ret;
}
else if (min == max && *RExC_parse == '?') {
@@ -15415,7 +15415,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
* eventually we'll have to artificially chunk the pattern into
* multiple nodes. */
if (! LOC && (node_type == EXACT || node_type == LEXACT)) {
- Size_t overhead = 1 + PL_regnode_arg_len[OP(REGNODE_p(ret))];
+ Size_t overhead = 1 + REGNODE_ARG_LEN(OP(REGNODE_p(ret)));
Size_t overhead_expansion = 0;
char temp[256];
Size_t max_nodes_for_string;
@@ -15434,7 +15434,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
* to save the string in the EXACT case before growing, and
* then copy it afterwards to its new location */
if (node_type == EXACT) {
- overhead_expansion = PL_regnode_arg_len[LEXACT] - PL_regnode_arg_len[EXACT];
+ overhead_expansion = REGNODE_ARG_LEN(LEXACT) - REGNODE_ARG_LEN(EXACT);
RExC_emit += overhead_expansion;
Copy(s0, temp, len, char);
}
@@ -17141,7 +17141,7 @@ redo_curchar:
* which isn't legal */
|| RExC_emit != orig_emit
+ NODE_STEP_REGNODE
- + PL_regnode_arg_len[REGEX_SET])
+ + REGNODE_ARG_LEN(REGEX_SET))
{
vFAIL("Expecting interpolated extended charclass");
}
@@ -19716,9 +19716,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
}
}
- ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
+ ret = REGNODE_GUTS(pRExC_state, op, REGNODE_ARG_LEN(op));
FILL_NODE(ret, op); /* We set the argument later */
- RExC_emit += NODE_STEP_REGNODE + PL_regnode_arg_len[op];
+ RExC_emit += NODE_STEP_REGNODE + REGNODE_ARG_LEN(op);
ANYOF_FLAGS(REGNODE_p(ret)) = anyof_flags;
/* Here, <cp_list> contains all the code points we can determine at
@@ -20623,7 +20623,7 @@ S_optimize_regclass(pTHX_
* non-UTF8 targets. The internal bitmap would serve
* both cases; with some extra code in regexec.c) */
op = ANYOFHbbm;
- *ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
+ *ret = REGNODE_GUTS(pRExC_state, op, REGNODE_ARG_LEN(op));
FILL_NODE(*ret, op);
((struct regnode_bbm *) REGNODE_p(*ret))->first_byte = low_utf8[0],
@@ -20639,7 +20639,7 @@ S_optimize_regclass(pTHX_
((struct regnode_bbm *) REGNODE_p(*ret))->bitmap,
REGNODE_BBM_BITMAP_LEN);
- RExC_emit += NODE_STEP_REGNODE + PL_regnode_arg_len[op];
+ RExC_emit += NODE_STEP_REGNODE + REGNODE_ARG_LEN(op);
return op;
}
else {
@@ -20649,7 +20649,7 @@ S_optimize_regclass(pTHX_
else {
op = ANYOFHs;
*ret = REGNODE_GUTS(pRExC_state, op,
- PL_regnode_arg_len[op] + STR_SZ(len));
+ REGNODE_ARG_LEN(op) + STR_SZ(len));
FILL_NODE(*ret, op);
((struct regnode_anyofhs *) REGNODE_p(*ret))->str_len
= len;
@@ -21283,7 +21283,7 @@ S_regnode_guts(pTHX_ RExC_state_t *pRExC_state, const STRLEN extra_size)
STATIC regnode_offset
S_regnode_guts_debug(pTHX_ RExC_state_t *pRExC_state, const U8 op, const STRLEN extra_size) {
PERL_ARGS_ASSERT_REGNODE_GUTS_DEBUG;
- assert(extra_size >= PL_regnode_arg_len[op] || REGNODE_TYPE(op) == ANYOF);
+ assert(extra_size >= REGNODE_ARG_LEN(op) || REGNODE_TYPE(op) == ANYOF);
return S_regnode_guts(aTHX_ pRExC_state, extra_size);
}
@@ -21297,12 +21297,12 @@ S_regnode_guts_debug(pTHX_ RExC_state_t *pRExC_state, const U8 op, const STRLEN
STATIC regnode_offset /* Location. */
S_reg_node(pTHX_ RExC_state_t *pRExC_state, U8 op)
{
- const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
+ const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, REGNODE_ARG_LEN(op));
regnode_offset ptr = ret;
PERL_ARGS_ASSERT_REG_NODE;
- assert(PL_regnode_arg_len[op] == 0);
+ assert(REGNODE_ARG_LEN(op) == 0);
FILL_ADVANCE_NODE(ptr, op);
RExC_emit = ptr;
@@ -21315,13 +21315,13 @@ S_reg_node(pTHX_ RExC_state_t *pRExC_state, U8 op)
STATIC regnode_offset /* Location. */
S_reganode(pTHX_ RExC_state_t *pRExC_state, U8 op, U32 arg)
{
- const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
+ const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, REGNODE_ARG_LEN(op));
regnode_offset ptr = ret;
PERL_ARGS_ASSERT_REGANODE;
/* ANYOF are special cased to allow non-length 1 args */
- assert(PL_regnode_arg_len[op] == 1);
+ assert(REGNODE_ARG_LEN(op) == 1);
FILL_ADVANCE_NODE_ARG(ptr, op, arg);
RExC_emit = ptr;
@@ -21334,7 +21334,7 @@ S_reganode(pTHX_ RExC_state_t *pRExC_state, U8 op, U32 arg)
STATIC regnode_offset /* Location. */
S_regpnode(pTHX_ RExC_state_t *pRExC_state, U8 op, SV * arg)
{
- const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
+ const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, REGNODE_ARG_LEN(op));
regnode_offset ptr = ret;
PERL_ARGS_ASSERT_REGPNODE;
@@ -21349,12 +21349,12 @@ S_reg2Lanode(pTHX_ RExC_state_t *pRExC_state, const U8 op, const U32 arg1, const
{
/* emit a node with U32 and I32 arguments */
- const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, PL_regnode_arg_len[op]);
+ const regnode_offset ret = REGNODE_GUTS(pRExC_state, op, REGNODE_ARG_LEN(op));
regnode_offset ptr = ret;
PERL_ARGS_ASSERT_REG2LANODE;
- assert(PL_regnode_arg_len[op] == 2);
+ assert(REGNODE_ARG_LEN(op) == 2);
FILL_ADVANCE_NODE_2L_ARG(ptr, op, arg1, arg2);
RExC_emit = ptr;
@@ -21371,7 +21371,7 @@ S_reg2Lanode(pTHX_ RExC_state_t *pRExC_state, const U8 op, const U32 arg1, const
* set up NEXT_OFF() of the inserted node if needed. Something like this:
*
* reginsert(pRExC, OPFAIL, orig_emit, depth+1);
-* NEXT_OFF(REGNODE_p(orig_emit)) = PL_regnode_arg_len[OPFAIL] + NODE_STEP_REGNODE;
+* NEXT_OFF(REGNODE_p(orig_emit)) = REGNODE_ARG_LEN(OPFAIL) + NODE_STEP_REGNODE;
*
* ALSO NOTE - FLAGS(newly-inserted-operator) will be set to 0 as well.
*/
@@ -21382,7 +21382,7 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_state, const U8 op,
regnode *src;
regnode *dst;
regnode *place;
- const int offset = PL_regnode_arg_len[(U8)op];
+ const int offset = REGNODE_ARG_LEN((U8)op);
const int size = NODE_STEP_REGNODE + offset;
DECLARE_AND_GET_RE_DEBUG_FLAGS;
diff --git a/regcomp.h b/regcomp.h
index f41d40f112..21117973e5 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -515,7 +515,7 @@ struct regnode_ssc {
/* find the regnode after this p by using the opcode we previously extracted
* with OP(p) */
-#define REGNODE_AFTER_opcode(p,op) REGNODE_AFTER_PLUS_DEBUG((p),PL_regnode_arg_len[op])
+#define REGNODE_AFTER_opcode(p,op) REGNODE_AFTER_PLUS_DEBUG((p),REGNODE_ARG_LEN(op))
/* find the regnode after this p by using the size of the struct associated with
* the opcode for p. use this when you *know* that p is pointer to a given type*/
@@ -555,13 +555,13 @@ struct regnode_ssc {
FILL_ADVANCE_NODE(offset, op); \
/* This is used generically for other operations \
* that have a longer argument */ \
- (offset) += PL_regnode_arg_len[op]; \
+ (offset) += REGNODE_ARG_LEN(op); \
} STMT_END
#define FILL_ADVANCE_NODE_ARGp(offset, op, arg) \
STMT_START { \
ARGp_SET(REGNODE_p(offset), arg); \
FILL_ADVANCE_NODE(offset, op); \
- (offset) += PL_regnode_arg_len[op]; \
+ (offset) += REGNODE_ARG_LEN(op); \
} STMT_END
#define FILL_ADVANCE_NODE_2L_ARG(offset, op, arg1, arg2) \
STMT_START { \
@@ -1411,6 +1411,7 @@ typedef enum {
#define REGNODE_TYPE(arg) PL_regnode_kind[(arg)]
#define REGNODE_OFF_BY_ARG(node) PL_regnode_of_by_arg[(node)]
+#define REGNODE_ARG_LEN(node) PL_regnode_arg_len[(node)]
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
#include "reginline.h"
diff --git a/reginline.h b/reginline.h
index 589e341e50..2da63d9639 100644
--- a/reginline.h
+++ b/reginline.h
@@ -37,7 +37,7 @@ Perl_regnode_after(pTHX_ const regnode *p, const bool varies)
assert(p);
const U8 op = OP(p);
assert(op < REGNODE_MAX);
- const regnode *ret = p + NODE_STEP_REGNODE + PL_regnode_arg_len[op];
+ const regnode *ret = p + NODE_STEP_REGNODE + REGNODE_ARG_LEN(op);
if (varies || PL_regnode_arg_len_varies[op])
ret += STR_SZ(STR_LEN(p));
return (regnode *)ret;