This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add strbeg argument to Perl_re_intuit_start()
authorDavid Mitchell <davem@iabyn.com>
Sat, 18 May 2013 14:05:57 +0000 (15:05 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 2 Jun 2013 21:28:50 +0000 (22:28 +0100)
commit52a21eb36148cc4f249f436a989e2cfe5c6bab1f
treee85cc834c1b706d4f5245c6aef489970a0e6621a
parentf9176b44e50593d8f3446da63d3989558f6d4c20
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.
embed.fnc
embed.h
ext/re/re.pm
ext/re/re.xs
perl.h
pod/perlreapi.pod
pp_hot.c
proto.h
regexec.c
regexp.h