summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-27 20:51:04 +0200
committerNicholas Clark <nick@ccl4.org>2011-07-01 14:05:40 +0200
commit4185c9197f4aefd1943fba0b9999fc3200fd902c (patch)
tree34f48cfebcfa6a796f4496c890400c3a7d89da6c /util.c
parent75fc7bf602cd498829b35780623ebe139c0a0483 (diff)
downloadperl-4185c9197f4aefd1943fba0b9999fc3200fd902c.tar.gz
Store C<study>'s data in in mg_ptr instead of interpreter variables.
This allows more than one C<study> to be active at the same time. It eliminates PL_screamfirst, PL_lastscream, PL_maxscream.
Diffstat (limited to 'util.c')
-rw-r--r--util.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/util.c b/util.c
index e099fdafab..4d03933e27 100644
--- a/util.c
+++ b/util.c
@@ -861,15 +861,23 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
register I32 stop_pos;
register const unsigned char *littleend;
I32 found = 0;
- const I32 *screamnext = PL_screamfirst + 256;
+ const MAGIC * mg;
+ I32 *screamfirst;
+ I32 *screamnext;
PERL_ARGS_ASSERT_SCREAMINSTR;
+ assert(SvMAGICAL(bigstr));
+ mg = mg_find(bigstr, PERL_MAGIC_study);
+ assert(mg);
assert(SvTYPE(littlestr) == SVt_PVMG);
assert(SvVALID(littlestr));
+ screamfirst = (I32 *)mg->mg_ptr;
+ screamnext = screamfirst + 256;
+
pos = *old_posp == -1
- ? PL_screamfirst[BmRARE(littlestr)] : screamnext[*old_posp];
+ ? screamfirst[BmRARE(littlestr)] : screamnext[*old_posp];
if (pos == -1) {
cant_find:
if ( BmRARE(littlestr) == '\n'