regmatch(): nextchar should always be positive
authorDavid Mitchell <davem@iabyn.com>
Fri, 14 Sep 2012 14:46:47 +0000 (15:46 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 26 Sep 2012 08:41:10 +0000 (09:41 +0100)
Remove the one bit of code that tests for < 0, and put in a
general assert.

regexec.c

index d95f29c..81dc1be 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3313,6 +3313,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
 
       reenter_switch:
 
+        assert(nextchr >= 0);
+
        switch (state_num) {
        case BOL:
            if (locinput == PL_bostr)
@@ -3956,8 +3958,6 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                break;
            }
            else {
-               if (nextchr < 0)
-                   nextchr = UCHARAT(locinput);
                if (!nextchr && locinput >= PL_regeol)
                    sayNO;
                if (!REGINCLASS(rex, scan, (U8*)locinput))