diff options
author | ache <ache@FreeBSD.org> | 1999-07-26 01:33:38 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-07-26 01:33:38 +0000 |
commit | 4f9366091d4e58f200ac5b744323bb9f7dbfbc70 (patch) | |
tree | 80336265a260d624bc0836996da07dd0bbb05399 | |
parent | 1a52c94214cf63b05a8396ef4786137fadcba0de (diff) | |
download | FreeBSD-src-4f9366091d4e58f200ac5b744323bb9f7dbfbc70.zip FreeBSD-src-4f9366091d4e58f200ac5b744323bb9f7dbfbc70.tar.gz |
unsigned char cleanup
fix wrong index from p_simp_re()
PR: 8790
Submitted by: Alexander Viro <viro@math.psu.edu> (partially)
-rw-r--r-- | lib/libc/regex/regcomp.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 67fdf47..a4e9e1d 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -407,7 +407,7 @@ register struct parse *p; ordinary(p, c); break; case '{': /* okay as ordinary except if digit follows */ - (void)REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT); + (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); /* FALLTHROUGH */ default: ordinary(p, c); @@ -419,7 +419,7 @@ register struct parse *p; c = PEEK(); /* we call { a repetition if followed by a digit */ if (!( c == '*' || c == '+' || c == '?' || - (c == '{' && MORE2() && isdigit(PEEK2())) )) + (c == '{' && MORE2() && isdigit((uch)PEEK2())) )) return; /* no repetition, we're done */ NEXT(); @@ -448,7 +448,7 @@ register struct parse *p; case '{': count = p_count(p); if (EAT(',')) { - if (isdigit(PEEK())) { + if (isdigit((uch)PEEK())) { count2 = p_count(p); (void)REQUIRE(count <= count2, REG_BADBR); } else /* single number with comma */ @@ -469,7 +469,7 @@ register struct parse *p; return; c = PEEK(); if (!( c == '*' || c == '+' || c == '?' || - (c == '{' && MORE2() && isdigit(PEEK2())) ) ) + (c == '{' && MORE2() && isdigit((uch)PEEK2())) ) ) return; SETERROR(REG_BADRPT); } @@ -551,7 +551,7 @@ int starordinary; /* is a leading * an ordinary character? */ c = GETNEXT(); if (c == '\\') { (void)REQUIRE(MORE(), REG_EESCAPE); - c = BACKSL | (unsigned char)GETNEXT(); + c = BACKSL | GETNEXT(); } switch (c) { case '.': @@ -613,7 +613,7 @@ int starordinary; /* is a leading * an ordinary character? */ (void)REQUIRE(starordinary, REG_BADRPT); /* FALLTHROUGH */ default: - ordinary(p, c &~ BACKSL); + ordinary(p, (char)c); break; } @@ -626,7 +626,7 @@ int starordinary; /* is a leading * an ordinary character? */ } else if (EATTWO('\\', '{')) { count = p_count(p); if (EAT(',')) { - if (MORE() && isdigit(PEEK())) { + if (MORE() && isdigit((uch)PEEK())) { count2 = p_count(p); (void)REQUIRE(count <= count2, REG_BADBR); } else /* single number with comma */ @@ -640,7 +640,7 @@ int starordinary; /* is a leading * an ordinary character? */ (void)REQUIRE(MORE(), REG_EBRACE); SETERROR(REG_BADBR); } - } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */ + } else if (c == '$') /* $ (but not \$) ends it */ return(1); return(0); @@ -657,7 +657,7 @@ register struct parse *p; register int count = 0; register int ndigits = 0; - while (MORE() && isdigit(PEEK()) && count <= DUPMAX) { + while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) { count = count*10 + (GETNEXT() - '0'); ndigits++; } @@ -990,7 +990,7 @@ static char /* if no counterpart, return ch */ othercase(ch) int ch; { - ch = (unsigned char)ch; + ch = (uch)ch; assert(isalpha(ch)); if (isupper(ch)) return(tolower(ch)); @@ -1015,7 +1015,7 @@ int ch; register char *oldend = p->end; char bracket[3]; - ch = (unsigned char)ch; + ch = (uch)ch; assert(othercase(ch) != ch); /* p_bracket() would recurse */ p->next = bracket; p->end = bracket+2; @@ -1039,10 +1039,10 @@ register int ch; { register cat_t *cap = p->g->categories; - if ((p->g->cflags®_ICASE) && isalpha((unsigned char)ch) && othercase(ch) != ch) + if ((p->g->cflags®_ICASE) && isalpha((uch)ch) && othercase(ch) != ch) bothcases(p, ch); else { - EMIT(OCHAR, (unsigned char)ch); + EMIT(OCHAR, (uch)ch); if (cap[ch] == 0) cap[ch] = p->g->ncategories++; } @@ -1290,7 +1290,7 @@ register cset *cs; for (i = 0; i < css; i++) if (CHIN(cs, i)) - return((unsigned char)i); + return((char)i); assert(never); return(0); /* arbitrary */ } @@ -1443,7 +1443,7 @@ int c; register uch *col; register int i; register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; - register unsigned uc = (unsigned char)c; + register unsigned uc = (uch)c; for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) if (col[uc] != 0) @@ -1464,8 +1464,8 @@ int c2; register uch *col; register int i; register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; - register unsigned uc1 = (unsigned char)c1; - register unsigned uc2 = (unsigned char)c2; + register unsigned uc1 = (uch)c1; + register unsigned uc2 = (uch)c2; for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) if (col[uc1] != col[uc2]) |