summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-12-23 19:13:24 -0700
committerKarl Williamson <public@khwilliamson.com>2011-12-23 19:17:00 -0700
commitf8b1e2fade1b5046a8f1d6493876ac4023c6dc9c (patch)
treeb20ec1ff68ce90bb1c770c31e576cef4977ae945
parenta9d15093c69d925c66bb4067fc5eb3fa74a43344 (diff)
downloadperl-f8b1e2fade1b5046a8f1d6493876ac4023c6dc9c.tar.gz
regcomp.c: Need to account for delta sizes
When a node can match varying sizes, the delta variable in the optimizer needs to change to account for that, and it can no longer match a fixed length string. This code was adapted from the existing code for the FOLDCHAR node that has to deal with the same problem.
-rw-r--r--regcomp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 100f73fad0..9bf400c0b9 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3291,11 +3291,16 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
if (min < 0) {
min = 0;
}
+ delta += abs(min_change);
if (flags & SCF_DO_SUBSTR) {
data->pos_min += l + min_change;
if (data->pos_min < 0) {
data->pos_min = 0;
}
+ data->pos_delta += abs(min_change);
+ if (min_change) {
+ data->longest = &(data->longest_float);
+ }
}
if (flags & SCF_DO_STCLASS_AND) {
/* Check whether it is compatible with what we know already! */