From d7c0b58cf68aeb7b08eee56a9e693a161f3f9106 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Fri, 4 Nov 2022 18:18:49 +0100 Subject: 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. --- regexec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'regexec.c') 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 */ -- cgit v1.2.1