[win32] protect sortcop from C<sort { sort { ... } ... } ...>
[p5sagit/p5-mst-13.2.git] / regexec.c
index 7285bea..250704c 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -979,7 +979,7 @@ regmatch(regnode *prog)
            n = ARG(scan);  /* which paren pair */
            s = regstartp[n];
            if (*reglastparen < n || !s)
-               break;                  /* Zero length always matches */
+               sayNO;                  /* Do not match unless seen CLOSEn. */
            if (s == regendp[n])
                break;
            /* Inline the first character, for speed. */
@@ -1313,7 +1313,7 @@ regmatch(regnode *prog)
                    *reglastparen = paren;
            }
 #endif 
-           scan = NEXTOPER(scan) + 4/sizeof(regnode);
+           scan = NEXTOPER(scan) + NODE_STEP_REGNODE;
            if (paren)
                scan += NEXT_OFF(scan); /* Skip former OPEN. */
            reginput = locinput;
@@ -1427,13 +1427,13 @@ regmatch(regnode *prog)
                *reglastparen = paren;
            ln = ARG1(scan);  /* min to match */
            n  = ARG2(scan);  /* max to match */
-            scan = regnext(NEXTOPER(scan) + 4/sizeof(regnode));
+            scan = regnext(NEXTOPER(scan) + NODE_STEP_REGNODE);
            goto repeat;
        case CURLY:
            paren = 0;
            ln = ARG1(scan);  /* min to match */
            n  = ARG2(scan);  /* max to match */
-           scan = NEXTOPER(scan) + 4/sizeof(regnode);
+           scan = NEXTOPER(scan) + NODE_STEP_REGNODE;
            goto repeat;
        case STAR:
            ln = 0;
@@ -1576,8 +1576,10 @@ regmatch(regnode *prog)
                logical = 0;
                sw = 1;
            }
-           if (OP(scan) == SUSPEND)
+           if (OP(scan) == SUSPEND) {
                locinput = reginput;
+               nextchar = UCHARAT(locinput);
+           }
            /* FALL THROUGH. */
        case LONGJMP:
          do_longjump: