diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-11-09 10:42:10 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-11-09 10:59:41 -0700 |
commit | 89378d8a0f995dd46081194bcf81c5d6ea016494 (patch) | |
tree | c4fe92b6d3905090e05ae0c2570a5ffecc5df393 /regexec.c | |
parent | b33105db76e14fea2faebc1d7c20b4baf24440e2 (diff) | |
download | perl-89378d8a0f995dd46081194bcf81c5d6ea016494.tar.gz |
regexec.c: Stop looking for match even sooner
This revised commit e067297c376fbbb5a0dc8428c65d922f11e1f4c6
slightly so that we round up to get the search stopping point.
We aren't matching partial characters, so if we were to match 3+1/3
characters, we really have to match 4 characters.
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1552,10 +1552,10 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, * fact that the Latin 1 folds are already determined, and the * only multi-char fold in that range is the sharp-s folding to * 'ss'. Thus, a pattern character can match as little as 1/3 of a - * string character. Adjust lnc accordingly, always matching at - * least 1 */ + * string character. Adjust lnc accordingly, rounding up, so that + * if we need to match at least 4+1/3 chars, that really is 5. */ expansion = (utf8_target) ? UTF8_MAX_FOLD_CHAR_EXPAND : 2; - lnc = (lnc < expansion) ? 1 : lnc / expansion; + lnc = (lnc + expansion - 1) / expansion; /* As in the non-UTF8 case, if we have to match 3 characters, and * only 2 are left, it's guaranteed to fail, so don't start a |