summaryrefslogtreecommitdiff
path: root/regexp.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-09-16 22:58:23 -0600
committerKarl Williamson <khw@cpan.org>2018-10-20 00:09:54 -0600
commitf55b7b26c4afa4768435a9da9f0798829bbf41f7 (patch)
tree6a1627fd12baa3b34adf7a5d5a4e7f8bcca2b82c /regexp.h
parent46fc0c4304793e740ce6eefd1561a6bb9cb9a6c8 (diff)
downloadperl-f55b7b26c4afa4768435a9da9f0798829bbf41f7.tar.gz
regcomp.c: Use regnode offsets during parsing
This changes the pattern parsing to use offsets from the first node in the pattern program, rather than direct addresses of such nodes. This is in preparation for a later change in which more mallocs will be done which will change those addresses, whereas the offsets will remain constant. Once the final program space is allocated, real addresses are used as currently. This limits the necessary changes to a few functions. Also, real addresses are used if they are constant across a function; again this limits the changes. Doing this introduces a new typedef for clarity 'regnode_offset' which is not a pointer, but a count. This necessitates changing a bunch of things to use 0 instead of NULL to indicate an error. A new boolean is also required to indicate if we are in the first or second passes of the pattern. And separate heap space is allocated for scratch during the first pass.
Diffstat (limited to 'regexp.h')
-rw-r--r--regexp.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/regexp.h b/regexp.h
index aa31846cbb..1c18e1d911 100644
--- a/regexp.h
+++ b/regexp.h
@@ -20,6 +20,8 @@
#include "utf8.h"
+typedef SSize_t regnode_offset;
+
struct regnode {
U8 flags;
U8 type;