summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-11-04 18:18:49 +0100
committerYves Orton <demerphq@gmail.com>2022-11-10 08:53:27 +0100
commitd7c0b58cf68aeb7b08eee56a9e693a161f3f9106 (patch)
tree555699e8b51789a7f34f204e09d2b57c8331313e /regexec.c
parentaf94e2b4109a87a2c399caa8aea8cbbcad6696f3 (diff)
downloadperl-d7c0b58cf68aeb7b08eee56a9e693a161f3f9106.tar.gz
regcomp.c - add a PARNO() macro to wrap the ARG() macro
We used the ARG() macro to access the parno data for the OPEN and CLOSE regops. This made it difficult to find what needed to change when the type and size or location of this data in the node was modified. Replacing this access with a specific macro makes the code more legible and future proof. This was actually backported from finding everything that broke by changing the regnode type for OPEN and CLOSE to 2L and moving the paren parameter to the 2L slot. We might do something like this in the future and separating the PARNO() macros from their implementation will make it easier.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/regexec.c b/regexec.c
index 873926f2bb..1d34e99a7e 100644
--- a/regexec.c
+++ b/regexec.c
@@ -183,7 +183,7 @@ static const char non_utf8_target_but_utf8_required[]
#define JUMPABLE(rn) ( \
OP(rn) == OPEN || \
(OP(rn) == CLOSE && \
- !EVAL_CLOSE_PAREN_IS(cur_eval,ARG(rn)) ) || \
+ !EVAL_CLOSE_PAREN_IS(cur_eval,PARNO(rn)) ) || \
OP(rn) == EVAL || \
OP(rn) == SUSPEND || OP(rn) == IFMATCH || \
OP(rn) == PLUS || OP(rn) == MINMOD || \
@@ -8455,7 +8455,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
#undef ST
case OPEN: /* ( */
- n = ARG(scan); /* which paren pair */
+ n = PARNO(scan); /* which paren pair */
rex->offs[n].start_tmp = locinput - reginfo->strbeg;
if (n > maxopenparen)
maxopenparen = n;
@@ -8477,7 +8477,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
case CLOSE: /* ) */
- n = ARG(scan); /* which paren pair */
+ n = PARNO(scan); /* which paren pair */
CLOSE_CAPTURE(n, rex->offs[n].start_tmp,
locinput - reginfo->strbeg);
if ( EVAL_CLOSE_PAREN_IS( cur_eval, n ) )
@@ -8513,7 +8513,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
if ( OP(cursor) != CLOSE )
continue;
- n = ARG(cursor);
+ n = PARNO(cursor);
if ( n > lastopen ) /* might be OPEN/CLOSE in the way */
continue; /* so skip this one */