This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Refactor expanded macro from prev. commit
authorKarl Williamson <khw@cpan.org>
Sun, 18 Nov 2018 22:24:45 +0000 (15:24 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 27 Nov 2018 05:24:33 +0000 (22:24 -0700)
regexec.c

index 582b031..32cea3f 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -6700,19 +6700,22 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
        case ANYOF:  /*   /[abc]/       */
             if (NEXTCHR_IS_EOS)
                 sayNO;
-           if (utf8_target && ! UTF8_IS_INVARIANT(*locinput)) {
+           if (  (! utf8_target || UTF8_IS_INVARIANT(*locinput))
+               && ! ANYOF_FLAGS(scan))
+            {
+                if (! ANYOF_BITMAP_TEST(scan, * (U8 *) (locinput))) {
+                   sayNO;
+                }
+               locinput++;
+            }
+            else {
                if (!reginclass(rex, scan, (U8*)locinput, (U8*)reginfo->strend,
                                                                    utf8_target))
+                {
                    sayNO;
-               locinput += UTF8SKIP(locinput);
-           }
-           else {
-               if (ANYOF_FLAGS(scan)
-                    ? ! reginclass(rex, scan, (U8*) locinput, (U8*) locinput+1, utf8_target)
-                    : ! ANYOF_BITMAP_TEST(scan, *(U8*) locinput))
-                   sayNO;
-               locinput++;
-           }
+                }
+                goto increment_locinput;
+            }
            break;
 
         case ANYOFM: