summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-27 17:14:39 +0200
committerNicholas Clark <nick@ccl4.org>2011-07-01 14:05:40 +0200
commit56e9eeb1a239fc995bf33475e31f8379bd01cbad (patch)
tree6cbb3b168a951fe169e6873a5cf01b590ec7da69 /pp.c
parent0177730e7e0c099d1250571eb39367a76e2d91eb (diff)
downloadperl-56e9eeb1a239fc995bf33475e31f8379bd01cbad.tar.gz
Change PL_screamnext to store absolute positions.
PL_screamnext gives the position of the next occurrence of the current octet. Previously it stored this as an offset from the current position, with -pos stored for "no more", so that the calculated new offset would be zero, allowing a zero/non-zero loop exit test in Perl_screaminstr(). Now it stores absolute position, with -1 for "no more". Also codify -1 as the "not present" value for PL_screamfirst, instead of any negative value.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c4
1 files changed, 2 insertions, 2 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;
}