summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp.c4
-rw-r--r--regexec.c2
-rw-r--r--util.c34
3 files changed, 21 insertions, 19 deletions
diff --git a/pp.c b/pp.c
index c72ce28862..61e9dc10e4 100644
--- a/pp.c
+++ b/pp.c
@@ -762,9 +762,9 @@ PP(pp_study)
while (--pos >= 0) {
register const I32 ch = s[pos];
if (sfirst[ch] >= 0)
- snext[pos] = sfirst[ch] - pos;
+ snext[pos] = sfirst[ch];
else
- snext[pos] = -pos;
+ snext[pos] = -1;
sfirst[ch] = pos;
}
diff --git a/regexec.c b/regexec.c
index 6ae2770be5..00fc7124f6 100644
--- a/regexec.c
+++ b/regexec.c
@@ -696,7 +696,7 @@ Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos,
I32 p = -1; /* Internal iterator of scream. */
I32 * const pp = data ? data->scream_pos : &p;
- if (PL_screamfirst[BmRARE(check)] >= 0
+ if (PL_screamfirst[BmRARE(check)] != -1
|| ( BmRARE(check) == '\n'
&& (BmPREVIOUS(check) == SvCUR(check) - 1)
&& SvTAIL(check) ))
diff --git a/util.c b/util.c
index 093b70e62a..9185e08308 100644
--- a/util.c
+++ b/util.c
@@ -867,9 +867,9 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
assert(SvTYPE(littlestr) == SVt_PVMG);
assert(SvVALID(littlestr));
- if (*old_posp == -1
- ? (pos = PL_screamfirst[BmRARE(littlestr)]) < 0
- : (((pos = *old_posp), pos += PL_screamnext[pos]) == 0)) {
+ pos = *old_posp == -1
+ ? PL_screamfirst[BmRARE(littlestr)] : PL_screamnext[*old_posp];
+ if (pos == -1) {
cant_find:
if ( BmRARE(littlestr) == '\n'
&& BmPREVIOUS(littlestr) == SvCUR(littlestr) - 1) {
@@ -901,27 +901,29 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
return NULL;
}
while (pos < previous + start_shift) {
- if (!(pos += PL_screamnext[pos]))
+ pos = PL_screamnext[pos];
+ if (pos == -1)
goto cant_find;
}
big -= previous;
do {
register const unsigned char *s, *x;
if (pos >= stop_pos) break;
- if (big[pos] != first)
- continue;
- for (x=big+pos+1,s=little; s < littleend; /**/ ) {
- if (*s++ != *x++) {
- s--;
- break;
+ if (big[pos] == first) {
+ for (x=big+pos+1,s=little; s < littleend; /**/ ) {
+ if (*s++ != *x++) {
+ s--;
+ break;
+ }
+ }
+ if (s == littleend) {
+ *old_posp = pos;
+ if (!last) return (char *)(big+pos);
+ found = 1;
}
}
- if (s == littleend) {
- *old_posp = pos;
- if (!last) return (char *)(big+pos);
- found = 1;
- }
- } while ( pos += PL_screamnext[pos] );
+ pos = PL_screamnext[pos];
+ } while (pos != -1);
if (last && found)
return (char *)(big+(*old_posp));
check_tail: