From: Chip Salzenberg Date: Thu, 28 Nov 1996 22:15:01 +0000 (+1200) Subject: Fix regex matching of chars with high bit set X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=95bac841e3f2a590eb559dd46af6c45fa3af0ee3;p=p5sagit%2Fp5-mst-13.2.git Fix regex matching of chars with high bit set --- diff --git a/regexec.c b/regexec.c index d9a893e..0ea40dd 100644 --- a/regexec.c +++ b/regexec.c @@ -339,9 +339,9 @@ I32 safebase; /* no need to remember string in subbase */ if (minlen) dontbother++,strend--; tmp = (s != startpos) ? UCHARAT(s - 1) : regprev; - tmp = (OP(c) == BOUND ? isALNUM(tmp) : isALNUM_LC(tmp)); + tmp = ((OP(c) == BOUND ? isALNUM(tmp) : isALNUM_LC(tmp)) != 0); while (s < strend) { - if (tmp != (OP(c) == BOUND ? isALNUM(*s) : isALNUM_LC(*s))) { + if (tmp == !(OP(c) == BOUND ? isALNUM(*s) : isALNUM_LC(*s))) { tmp = !tmp; if (regtry(prog, s)) goto got_it; @@ -358,9 +358,9 @@ I32 safebase; /* no need to remember string in subbase */ if (minlen) dontbother++,strend--; tmp = (s != startpos) ? UCHARAT(s - 1) : regprev; - tmp = (OP(c) == NBOUND ? isALNUM(tmp) : isALNUM_LC(tmp)); + tmp = ((OP(c) == NBOUND ? isALNUM(tmp) : isALNUM_LC(tmp)) != 0); while (s < strend) { - if (tmp != (OP(c) == NBOUND ? isALNUM(*s) : isALNUM_LC(*s))) + if (tmp == !(OP(c) == NBOUND ? isALNUM(*s) : isALNUM_LC(*s))) tmp = !tmp; else if (regtry(prog, s)) goto got_it; @@ -705,7 +705,7 @@ char *prog; s = OPERAND(scan); ln = *s++; /* Inline the first character, for speed. */ - if (*s != nextchar) + if (UCHARAT(s) != nextchar) sayNO; if (regeol - locinput < ln) sayNO; @@ -781,7 +781,7 @@ char *prog; ln = isALNUM_LC(ln); n = isALNUM_LC(nextchar); } - if ((ln == n) == (OP(scan) == BOUND || OP(scan) == BOUNDL)) + if (((!ln) == (!n)) == (OP(scan) == BOUND || OP(scan) == BOUNDL)) sayNO; break; case SPACEL: @@ -828,7 +828,7 @@ char *prog; if (s == regendp[n]) break; /* Inline the first character, for speed. */ - if (*s != nextchar) + if (UCHARAT(s) != nextchar) sayNO; ln = regendp[n] - s; if (locinput + ln > regeol)