diff options
author | Karl Williamson <khw@cpan.org> | 2018-09-16 22:58:23 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-10-20 00:09:54 -0600 |
commit | f55b7b26c4afa4768435a9da9f0798829bbf41f7 (patch) | |
tree | 6a1627fd12baa3b34adf7a5d5a4e7f8bcca2b82c /regexp.h | |
parent | 46fc0c4304793e740ce6eefd1561a6bb9cb9a6c8 (diff) | |
download | perl-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.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -20,6 +20,8 @@ #include "utf8.h" +typedef SSize_t regnode_offset; + struct regnode { U8 flags; U8 type; |