This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Don't retest the same byte immediately
authorKarl Williamson <khw@cpan.org>
Fri, 2 Feb 2018 02:42:50 +0000 (19:42 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 2 Feb 2018 04:37:19 +0000 (21:37 -0700)
In this macro, COND has just returned true for the given byte.  We then
need to test that the rest of the relevant portion of the input string
and pattern match.  But before this commit, we started at the byte we
already know the answer for.  Change to test starting one position over.

regexec.c

index 73b1f47..d078c29 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1902,7 +1902,7 @@ STMT_START {
 STMT_START {                                              \
     while (s <= e) {                                      \
        if ( (COND)                                       \
-            && (ln == 1 || folder(s, pat_string, ln))    \
+            && (ln == 1 || folder(s+1, pat_string+1, ln-1))\
             && (reginfo->intuit || regtry(reginfo, &s)) )\
            goto got_it;                                  \
        s++;                                              \