This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Give context for ANYOFV call
authorKarl Williamson <public@khwilliamson.com>
Wed, 9 Feb 2011 17:07:47 +0000 (10:07 -0700)
committerKarl Williamson <public@khwilliamson.com>
Mon, 14 Feb 2011 15:41:37 +0000 (08:41 -0700)
This converts one case where ANYOFV is now usable to allow it to match
more than one character.

regexec.c

index e0d27ea..8886c25 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -6085,11 +6085,15 @@ S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max, int depth)
        break;
     case ANYOFV:
     case ANYOF:
-       if (utf8_target) {
+       if (utf8_target || OP(p) == ANYOFV) {
+           STRLEN inclasslen;
            loceol = PL_regeol;
-           while (hardcount < max && scan < loceol &&
-                  reginclass(prog, p, (U8*)scan, 0, utf8_target)) {
-               scan += UTF8SKIP(scan);
+           inclasslen = loceol - scan;
+           while (hardcount < max
+                  && ((inclasslen = loceol - scan) > 0)
+                  && reginclass(prog, p, (U8*)scan, &inclasslen, utf8_target))
+           {
+               scan += inclasslen;
                hardcount++;
            }
        } else {