summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-12-23 19:13:24 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-19 11:58:18 -0700
commitd2197104bf4db0983b266cf51c5f9b509a1d606b (patch)
tree3e8563db581741b2786c5ca426b4e30aaa27d86c /regcomp.c
parentf646642f35679c7859c80485da40c0d146e5550c (diff)
downloadperl-d2197104bf4db0983b266cf51c5f9b509a1d606b.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.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 11f1ca4ef1..79acca64d3 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! */