Re: [PATCH for _66] Makefile.SH problem on dos/djgpp
[p5sagit/p5-mst-13.2.git] / regexec.c
index 5ef0313..dd51bc1 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -697,7 +697,7 @@ regtry(regexp *prog, char *startpos)
        }
     }
     REGCP_SET;
-    if (regmatch(prog->program + 1) && reginput >= regtill) {
+    if (regmatch(prog->program + 1)) {
        prog->startp[0] = startpos;
        prog->endp[0] = reginput;
        return 1;
@@ -776,13 +776,9 @@ regmatch(regnode *prog)
                          SvPVX(prop));
        } );
 
-#ifdef REGALIGN
        next = scan + NEXT_OFF(scan);
        if (next == scan)
            next = NULL;
-#else
-       next = regnext(scan);
-#endif
 
        switch (OP(scan)) {
        case BOL:
@@ -1242,15 +1238,11 @@ regmatch(regnode *prog)
                            regendp[n] = 0;
                        *reglastparen = n;
                        scan = next;
-#ifdef REGALIGN
                        /*SUPPRESS 560*/
                        if (n = (c1 == BRANCH ? NEXT_OFF(next) : ARG(next)))
                            next += n;
                        else
                            next = NULL;
-#else
-                       next = regnext(next);
-#endif
                        inner = NEXTOPER(scan);
                        if (c1 == BRANCHJ) {
                            inner = NEXTOPER(inner);
@@ -1266,7 +1258,7 @@ regmatch(regnode *prog)
            break;
        case CURLYM:
        {
-           I32 l;
+           I32 l = 0;
            CHECKPOINT lastcp;
            
            /* We suppose that the next guy does not need
@@ -1274,7 +1266,6 @@ regmatch(regnode *prog)
               and has no parenths to influence future backrefs. */
            ln = ARG1(scan);  /* min to match */
            n  = ARG2(scan);  /* max to match */
-#ifdef REGALIGN_STRUCT
            paren = scan->flags;
            if (paren) {
                if (paren > regsize)
@@ -1282,7 +1273,6 @@ regmatch(regnode *prog)
                if (paren > *reglastparen)
                    *reglastparen = paren;
            }
-#endif 
            scan = NEXTOPER(scan) + NODE_STEP_REGNODE;
            if (paren)
                scan += NEXT_OFF(scan); /* Skip former OPEN. */
@@ -1514,8 +1504,11 @@ regmatch(regnode *prog)
            }
            sayNO;
            break;
-       case SUCCEED:
        case END:
+           if (locinput < regtill)
+               sayNO;                  /* Cannot match: too short. */
+           /* Fall through */
+       case SUCCEED:
            reginput = locinput;        /* put where regtry can find it */
            sayYES;                     /* Success! */
        case SUSPEND: