summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-02-12 05:36:36 +0100
committerHugo van der Sanden <hv@crypt.org>2022-02-18 15:08:25 +0000
commitf08cf4076ad9433e9a9aa85b316dbb203517a353 (patch)
tree76e9d6254a81618993b1d1d6fa575ce6bc63f070
parent615094ef9383c35e9fb5760a1c6f3f1c92fedc5d (diff)
downloadperl-f08cf4076ad9433e9a9aa85b316dbb203517a353.tar.gz
regcomp.h: change regexp_internal attribute from I32 to U32
This changes the name_list_idx attribute from I32 to a U32 as it will never be negative, and as of a963d6d5acabdd8c7 a 0 can be safely used to represent "no value" for items in the 'data' array. I noticed this while cleaning up the offsets debug logic and updating the perlreguts documentation, so I figured I might as well clean it up at the same time.
-rw-r--r--pod/perlreguts.pod6
-rw-r--r--regcomp.h5
2 files changed, 7 insertions, 4 deletions
diff --git a/pod/perlreguts.pod b/pod/perlreguts.pod
index 2aae739d9b..e19f157058 100644
--- a/pod/perlreguts.pod
+++ b/pod/perlreguts.pod
@@ -832,7 +832,7 @@ value to other engine implementations.
struct reg_data *data;
struct reg_code_blocks *code_blocks;
U32 proglen;
- int name_list_idx;
+ U32 name_list_idx;
regnode program[1];
} regexp_internal;
@@ -900,8 +900,8 @@ Stores the length of the compiled program in units of regops.
This is the index into the data array where an AV is stored that contains
the names of any named capture buffers in the pattern, should there be
-any. This is only used in the debugging version of the regex engine. It
-will be 0 if there is no such data.
+any. This is only used in the debugging version of the regex engine and
+when RXp_PAREN_NAMES(prog) is true. It will be 0 if there is no such data.
=item C<program>
diff --git a/regcomp.h b/regcomp.h
index 6b8dc27642..2705463474 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -71,7 +71,10 @@ typedef struct regexp_internal {
strictly reserved for internal purposes. */
struct reg_code_blocks *code_blocks;/* positions of literal (?{}) */
U32 proglen; /* size of the compiled program in regnodes */
- int name_list_idx; /* Optional data index of an array of paren names */
+ U32 name_list_idx; /* Optional data index of an array of paren names,
+ only valid when RXp_PAREN_NAMES(prog) is true,
+ 0 means "no value" like any other index into the
+ data array.*/
regnode program[1]; /* Unwarranted chumminess with compiler. */
} regexp_internal;