summaryrefslogtreecommitdiff
path: root/regexp.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-05-18 15:05:57 +0100
committerDavid Mitchell <davem@iabyn.com>2013-06-02 22:28:50 +0100
commit52a21eb36148cc4f249f436a989e2cfe5c6bab1f (patch)
treee85cc834c1b706d4f5245c6aef489970a0e6621a /regexp.h
parentf9176b44e50593d8f3446da63d3989558f6d4c20 (diff)
downloadperl-52a21eb36148cc4f249f436a989e2cfe5c6bab1f.tar.gz
add strbeg argument to Perl_re_intuit_start()
(note that this is a change both to the perl API and the regex engine plugin API). Currently, Perl_re_intuit_start() is passed an SV, plus pointers to: where in the string to start matching (strpos); and to the end of the string (strend). Unlike Perl_regexec_flags(), it doesn't also have a strbeg arg. Because of this this, it guesses strbeg: based on the passed SV (if its svPOK()); or just set to strpos otherwise. This latter can happen if for example the SV is overloaded. Note also that this latter guess is wrong, and could in theory make /\b.../ fail. But just to confuse matters, although Perl_re_intuit_start() itself uses its guesstimate strbeg var, some of the functions it calls use the global value of PL_bostr instead. To make this work, the *callers* of Perl_re_intuit_start() currently set PL_bostr first. This is why \b doesn't actually break. The fix to this unholy mess is to simply add a strbeg arg to Perl_re_intuit_start(). It's also the first step to eliminating PL_bostr altogether.
Diffstat (limited to 'regexp.h')
-rw-r--r--regexp.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/regexp.h b/regexp.h
index 3479f260cf..72d233999d 100644
--- a/regexp.h
+++ b/regexp.h
@@ -157,8 +157,13 @@ typedef struct regexp_engine {
I32 (*exec) (pTHX_ REGEXP * const rx, char* stringarg, char* strend,
char* strbeg, I32 minend, SV* screamer,
void* data, U32 flags);
- char* (*intuit) (pTHX_ REGEXP * const rx, SV *sv, char *strpos,
- char *strend, const U32 flags,
+ char* (*intuit) (pTHX_
+ REGEXP * const rx,
+ SV *sv,
+ const char * const strbeg,
+ char *strpos,
+ char *strend,
+ const U32 flags,
re_scream_pos_data *data);
SV* (*checkstr) (pTHX_ REGEXP * const rx);
void (*free) (pTHX_ REGEXP * const rx);