summaryrefslogtreecommitdiff
path: root/regcomp.h
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 /regcomp.h
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 'regcomp.h')
-rw-r--r--regcomp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/regcomp.h b/regcomp.h
index 861adde893..d74950e810 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -386,6 +386,8 @@ struct regnode_ssc {
((struct regnode_string *)p)->string)
#define OPERANDs(p) STRINGs(p)
+#define PARNO(p) ARG(p) /* APPLIES for OPEN and CLOSE only */
+
/* Long strings. Currently limited to length 18 bits, which handles a 262000
* byte string. The limiting factor is the 16 bit 'next_off' field, which
* points to the next regnode, so the furthest away it can be is 2**16. On
@@ -436,6 +438,7 @@ struct regnode_ssc {
#define ARG2_LOC(p) (((struct regnode_2 *)p)->arg2)
#define ARG2L_LOC(p) (((struct regnode_2L *)p)->arg2)
+
/* These should no longer be used directly in most cases. Please use
* the REGNODE_AFTER() macros instead. */
#define NODE_STEP_REGNODE 1 /* sizeof(regnode)/sizeof(regnode) */