summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-27 17:58:10 +0200
committerNicholas Clark <nick@ccl4.org>2011-07-01 14:05:40 +0200
commit75fc7bf602cd498829b35780623ebe139c0a0483 (patch)
tree63b0614fc1223a0d33bb7947ab2072a979e9f537
parent56e9eeb1a239fc995bf33475e31f8379bd01cbad (diff)
downloadperl-75fc7bf602cd498829b35780623ebe139c0a0483.tar.gz
Merge PL_scream{first,next} into one allocated buffer.
Effectively, PL_screamnext is now PL_screamfirst + 256. The actual interpreter variable PL_screamnext is eliminated.
-rw-r--r--embedvar.h2
-rw-r--r--intrpvar.h1
-rw-r--r--perl.c2
-rw-r--r--pp.c13
-rw-r--r--sv.c1
-rw-r--r--util.c7
6 files changed, 9 insertions, 17 deletions
diff --git a/embedvar.h b/embedvar.h
index a540fd604f..c25fb57b66 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -269,7 +269,6 @@
#define PL_scopestack_max (vTHX->Iscopestack_max)
#define PL_scopestack_name (vTHX->Iscopestack_name)
#define PL_screamfirst (vTHX->Iscreamfirst)
-#define PL_screamnext (vTHX->Iscreamnext)
#define PL_secondgv (vTHX->Isecondgv)
#define PL_sharehook (vTHX->Isharehook)
#define PL_sig_pending (vTHX->Isig_pending)
@@ -603,7 +602,6 @@
#define PL_Iscopestack_max PL_scopestack_max
#define PL_Iscopestack_name PL_scopestack_name
#define PL_Iscreamfirst PL_screamfirst
-#define PL_Iscreamnext PL_screamnext
#define PL_Isecondgv PL_secondgv
#define PL_Isharehook PL_sharehook
#define PL_Isig_pending PL_sig_pending
diff --git a/intrpvar.h b/intrpvar.h
index 9dda6a3ab1..3a64cb23af 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -156,7 +156,6 @@ PERLVAR(Iefloatsize, STRLEN)
/* regex stuff */
PERLVAR(Iscreamfirst, I32 *)
-PERLVAR(Iscreamnext, I32 *)
PERLVAR(Ilastscream, SV *)
PERLVAR(Ireg_state, struct re_save_state)
diff --git a/perl.c b/perl.c
index 417b2fd4b9..00aa02813f 100644
--- a/perl.c
+++ b/perl.c
@@ -910,8 +910,6 @@ perl_destruct(pTHXx)
PL_lastscream = NULL;
Safefree(PL_screamfirst);
PL_screamfirst = 0;
- Safefree(PL_screamnext);
- PL_screamnext = 0;
/* float buffer */
Safefree(PL_efloatbuf);
diff --git a/pp.c b/pp.c
index 61e9dc10e4..992eaff8d9 100644
--- a/pp.c
+++ b/pp.c
@@ -740,24 +740,21 @@ PP(pp_study)
if (pos > PL_maxscream) {
if (PL_maxscream < 0) {
PL_maxscream = pos + 80;
- Newx(PL_screamfirst, 256, I32);
- Newx(PL_screamnext, PL_maxscream, I32);
+ Newx(PL_screamfirst, 256 + PL_maxscream, I32);
}
else {
PL_maxscream = pos + pos / 4;
- Renew(PL_screamnext, PL_maxscream, I32);
+ Renew(PL_screamfirst, 256 + PL_maxscream, I32);
}
}
- sfirst = PL_screamfirst;
- snext = PL_screamnext;
+ snext = sfirst = PL_screamfirst;
- if (!sfirst || !snext)
+ if (!sfirst)
DIE(aTHX_ "do_study: out of memory");
for (ch = 256; ch; --ch)
- *sfirst++ = -1;
- sfirst -= 256;
+ *snext++ = -1;
while (--pos >= 0) {
register const I32 ch = s[pos];
diff --git a/sv.c b/sv.c
index 445f9d45e5..75238bc580 100644
--- a/sv.c
+++ b/sv.c
@@ -12995,7 +12995,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
/* regex stuff */
PL_screamfirst = NULL;
- PL_screamnext = NULL;
PL_maxscream = -1; /* reinits on demand */
PL_lastscream = NULL;
diff --git a/util.c b/util.c
index 9185e08308..e099fdafab 100644
--- a/util.c
+++ b/util.c
@@ -861,6 +861,7 @@ 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;
PERL_ARGS_ASSERT_SCREAMINSTR;
@@ -868,7 +869,7 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
assert(SvVALID(littlestr));
pos = *old_posp == -1
- ? PL_screamfirst[BmRARE(littlestr)] : PL_screamnext[*old_posp];
+ ? PL_screamfirst[BmRARE(littlestr)] : screamnext[*old_posp];
if (pos == -1) {
cant_find:
if ( BmRARE(littlestr) == '\n'
@@ -901,7 +902,7 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
return NULL;
}
while (pos < previous + start_shift) {
- pos = PL_screamnext[pos];
+ pos = screamnext[pos];
if (pos == -1)
goto cant_find;
}
@@ -922,7 +923,7 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
found = 1;
}
}
- pos = PL_screamnext[pos];
+ pos = screamnext[pos];
} while (pos != -1);
if (last && found)
return (char *)(big+(*old_posp));