summaryrefslogtreecommitdiff
path: root/embed.fnc
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-05-17 17:38:00 +0100
committerDavid Mitchell <davem@iabyn.com>2013-06-02 22:28:49 +0100
commit02d5137b98854dd95a1eb9d4bee9d44d656f2c16 (patch)
tree8266e5bc1d8aa4bcd7ee41c139e3e485d63721a3 /embed.fnc
parent3a74e0e282cd5c2593f9477923d3bcb1f32ece37 (diff)
downloadperl-02d5137b98854dd95a1eb9d4bee9d44d656f2c16.tar.gz
make more use of regmatch_info struct.
regmatch_info is a small struct that is currently directly allocated as a local var in Perl_regexec_flags(), and has a few fields that maintain part of the state of the current pattern match. It is passed as an arg to various functions that regexec_flags() calls, such as regtry(). In some ways its a rival to PL_reg_state, which also maintains state for the current match, but which is a global variable (whose state needs saving and restoring whenever the regex engine goes reentrant). It makes more sense to store state in the regmatch_info struct, and as a first step in moving more state to there, this commit makes more use of regmatch_info. In particular, it makes Perl_re_intuit_start() also allocate such a struct, so that now *both* the main execution entry points to the regex engine make use of it. It's also now passed as an arg to more of the static functions that these two op-level ones call. Two changes of special note. First, whether S_find_byclass() got called with a null reginfo pointer of not indicated whether it had been called from Perl_regexec_flags() (with a valid reginfo pointer), or from Perl_re_intuit_start() (null pointer). Since they both pass non-null reginfo pointers now, instead we add an extra field, reginfo->intuit that indicates who's the top-level caller. Secondly, to allow in future for various macros to uniformly refer to values like reginfo->foo, where the structure is actually allocated as a local var in Perl_regexec_flags(), we change the reginfo from being the struct itself to being a pointer to the struct, (so Perl_regexec_flags itself now uses reginfo->foo too rather than reginfo.foo). In summary, all the above is essentially window dressing that makes no functional changes to the code, but will facilitate future changes.
Diffstat (limited to 'embed.fnc')
-rw-r--r--embed.fnc5
1 files changed, 4 insertions, 1 deletions
diff --git a/embed.fnc b/embed.fnc
index 0c9be6af67..ed32623bf8 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -2069,7 +2069,10 @@ ERs |bool |isFOO_lc |const U8 classnum|const U8 character
ERs |bool |isFOO_utf8_lc |const U8 classnum|NN const U8* character
ERs |I32 |regmatch |NN regmatch_info *reginfo|NN char *startpos|NN regnode *prog
ERs |I32 |regrepeat |NN regexp *prog|NN char **startposp \
- |NN const regnode *p|I32 max|int depth \
+ |NN const regnode *p \
+ |NN regmatch_info *const reginfo \
+ |I32 max \
+ |int depth \
|bool is_utf8_pat
ERs |I32 |regtry |NN regmatch_info *reginfo|NN char **startposp
ERs |bool |reginclass |NULLOK regexp * const prog|NN const regnode * const n|NN const U8 * const p\