From 4185c9197f4aefd1943fba0b9999fc3200fd902c Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 27 Jun 2011 20:51:04 +0200 Subject: Store C's data in in mg_ptr instead of interpreter variables. This allows more than one C to be active at the same time. It eliminates PL_screamfirst, PL_lastscream, PL_maxscream. --- util.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'util.c') 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' -- cgit v1.2.1