diff --git a/contrib/awk/awk.h b/contrib/awk/awk.h index b87a645a118a..3ab2015c8bb6 100644 --- a/contrib/awk/awk.h +++ b/contrib/awk/awk.h @@ -65,30 +65,30 @@ extern int errno; #if defined(STDC_HEADERS) || (!defined(isascii) && !defined(HAVE_ISASCII)) #define ISASCII(c) 1 #else -#define ISASCII(c) isascii((unsigned char)c) +#define ISASCII(c) isascii(c) #endif #ifdef isblank -#define ISBLANK(c) (ISASCII(c) && isblank((unsigned char)c)) +#define ISBLANK(c) (ISASCII(c) && isblank(c)) #else #define ISBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef isgraph -#define ISGRAPH(c) (ISASCII(c) && isgraph((unsigned char)c)) +#define ISGRAPH(c) (ISASCII(c) && isgraph(c)) #else -#define ISGRAPH(c) (ISASCII(c) && isprint((unsigned char)c) && !isspace((unsigned char)c)) +#define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c)) #endif -#define ISPRINT(c) (ISASCII (c) && isprint ((unsigned char)c)) -#define ISDIGIT(c) (ISASCII (c) && isdigit ((unsigned char)c)) -#define ISALNUM(c) (ISASCII (c) && isalnum ((unsigned char)c)) -#define ISALPHA(c) (ISASCII (c) && isalpha ((unsigned char)c)) -#define ISCNTRL(c) (ISASCII (c) && iscntrl ((unsigned char)c)) -#define ISLOWER(c) (ISASCII (c) && islower ((unsigned char)c)) -#define ISPUNCT(c) (ISASCII (c) && ispunct ((unsigned char)c)) -#define ISSPACE(c) (ISASCII (c) && isspace ((unsigned char)c)) -#define ISUPPER(c) (ISASCII (c) && isupper ((unsigned char)c)) -#define ISXDIGIT(c) (ISASCII (c) && isxdigit ((unsigned char)c)) +#define ISPRINT(c) (ISASCII (c) && isprint (c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) +#define ISALNUM(c) (ISASCII (c) && isalnum (c)) +#define ISALPHA(c) (ISASCII (c) && isalpha (c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) +#define ISLOWER(c) (ISASCII (c) && islower (c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) +#define ISSPACE(c) (ISASCII (c) && isspace (c)) +#define ISUPPER(c) (ISASCII (c) && isupper (c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) #ifdef __STDC__ diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c index 32bde1c1b73c..dc2c1d3cff94 100644 --- a/contrib/awk/builtin.c +++ b/contrib/awk/builtin.c @@ -231,7 +231,7 @@ NODE *tree; while (l1 > 0) { if (l2 > l1) break; - if (casetable[(unsigned char)*p1] == casetable[(unsigned char)*p2] + if (casetable[(int)*p1] == casetable[(int)*p2] && (l2 == 1 || strncasecmp(p1, p2, l2) == 0)) { ret = 1 + s1->stlen - l1; break; @@ -2038,7 +2038,7 @@ size_t len; } } else if (*str == '0') { for (; len > 0; len--) { - if (! isdigit((unsigned char)*str) || *str == '8' || *str == '9') + if (! isdigit(*str) || *str == '8' || *str == '9') goto done; retval = (retval * 8) + (*str - '0'); str++; diff --git a/contrib/awk/dfa.c b/contrib/awk/dfa.c index 72ef552a1666..88e8e3e2d951 100644 --- a/contrib/awk/dfa.c +++ b/contrib/awk/dfa.c @@ -736,9 +736,9 @@ lex() setbit(c3, ccl); if (case_fold) if (ISUPPER(c3)) - setbit(tolower((unsigned char)c3), ccl); + setbit(tolower(c3), ccl); else if (ISLOWER(c3)) - setbit(toupper((unsigned char)c3), ccl); + setbit(toupper(c3), ccl); } } #else @@ -747,9 +747,9 @@ lex() setbit(c, ccl); if (case_fold) if (ISUPPER(c)) - setbit(tolower((unsigned char)c), ccl); + setbit(tolower(c), ccl); else if (ISLOWER(c)) - setbit(toupper((unsigned char)c), ccl); + setbit(toupper(c), ccl); ++c; } #endif @@ -773,10 +773,10 @@ lex() { zeroset(ccl); setbit(c, ccl); - if (isupper((unsigned char)c)) - setbit(tolower((unsigned char)c), ccl); + if (isupper(c)) + setbit(tolower(c), ccl); else - setbit(toupper((unsigned char)c), ccl); + setbit(toupper(c), ccl); return lasttok = CSET + charclass_index(ccl); } return c; @@ -2047,7 +2047,7 @@ dfacomp(s, len, d, searchflag) case_fold = 0; for (i = 0; i < len; ++i) if (ISUPPER(s[i])) - lcopy[i] = tolower((unsigned char)s[i]); + lcopy[i] = tolower(s[i]); else lcopy[i] = s[i]; diff --git a/contrib/awk/eval.c b/contrib/awk/eval.c index 6ba00f6a5c06..aa2e88162f15 100644 --- a/contrib/awk/eval.c +++ b/contrib/awk/eval.c @@ -1652,13 +1652,13 @@ NODE *n; return 0; while (*p && strchr(" +-#", *p) != NULL) /* flags */ p++; - while (*p && isdigit((unsigned char)*p)) /* width - %*.*g is NOT allowed */ + while (*p && isdigit(*p)) /* width - %*.*g is NOT allowed */ p++; - if (*p == '\0' || (*p != '.' && ! isdigit((unsigned char)*p))) + if (*p == '\0' || (*p != '.' && ! isdigit(*p))) return 0; if (*p == '.') p++; - while (*p && isdigit((unsigned char)*p)) /* precision */ + while (*p && isdigit(*p)) /* precision */ p++; if (*p == '\0' || strchr("efgEG", *p) == NULL) return 0; diff --git a/contrib/awk/field.c b/contrib/awk/field.c index 81ee12130e9a..31c962879582 100644 --- a/contrib/awk/field.c +++ b/contrib/awk/field.c @@ -550,9 +550,9 @@ NODE *n; else fschar = fs->stptr[0]; - onecase = (IGNORECASE && isalpha((unsigned char)fschar)); + onecase = (IGNORECASE && isalpha(fschar)); if (onecase) - fschar = casetable[(unsigned char) fschar]; + fschar = casetable[(int) fschar]; /* before doing anything save the char at *end */ sav = *end; @@ -562,7 +562,7 @@ NODE *n; for (; nf < up_to;) { field = scan; if (onecase) { - while (casetable[(unsigned char) *scan] != fschar) + while (casetable[(int) *scan] != fschar) scan++; } else { while (*scan != fschar) diff --git a/contrib/awk/io.c b/contrib/awk/io.c index 5db2796b6866..74d9a8d73a37 100644 --- a/contrib/awk/io.c +++ b/contrib/awk/io.c @@ -1540,9 +1540,9 @@ int *errcode; /* pointer to error variable */ else rs = (char) grRS; - onecase = (IGNORECASE && isalpha((unsigned char)rs)); + onecase = (IGNORECASE && isalpha(rs)); if (onecase) - rs = casetable[(unsigned char)rs]; + rs = casetable[rs]; /* set up sentinel */ if (iop->buf) { @@ -1703,7 +1703,7 @@ int *errcode; /* pointer to error variable */ } /* search for RS, #2, RS = */ if (onecase) { - while (casetable[(unsigned char) *bp++] != rs) + while (casetable[(int) *bp++] != rs) continue; } else { while (*bp++ != rs) @@ -1732,7 +1732,7 @@ int *errcode; /* pointer to error variable */ bstart = iop->off = bp; bp--; - if (onecase ? casetable[(unsigned char) *bp] != rs : *bp != rs) { + if (onecase ? casetable[(int) *bp] != rs : *bp != rs) { bp++; bstart = bp; } @@ -1816,9 +1816,9 @@ int *errcode; /* pointer to error variable */ else rs = (char) grRS; - onecase = (IGNORECASE && isalpha((unsigned char)rs)); + onecase = (IGNORECASE && isalpha(rs)); if (onecase) - rs = casetable[(unsigned char)rs]; + rs = casetable[rs]; /* if RS = "", skip leading newlines at the front of the file */ if (grRS == FALSE && iop->off == iop->buf) { @@ -1891,7 +1891,7 @@ int *errcode; /* pointer to error variable */ */ /* search for RS, #2, RS = */ if (onecase) { - while (bp < end && casetable[(unsigned char)*bp++] != rs) + while (bp < end && casetable[*bp++] != rs) continue; } else { while (bp < end && *bp++ != rs) diff --git a/contrib/awk/main.c b/contrib/awk/main.c index 35fb119c202e..92445de4e62f 100644 --- a/contrib/awk/main.c +++ b/contrib/awk/main.c @@ -644,11 +644,11 @@ char *arg; *cp++ = '\0'; /* first check that the variable name has valid syntax */ badvar = FALSE; - if (! isalpha((unsigned char)arg[0]) && arg[0] != '_') + if (! isalpha(arg[0]) && arg[0] != '_') badvar = TRUE; else for (cp2 = arg+1; *cp2; cp2++) - if (! isalnum((unsigned char)*cp2) && *cp2 != '_') { + if (! isalnum(*cp2) && *cp2 != '_') { badvar = TRUE; break; } diff --git a/contrib/awk/node.c b/contrib/awk/node.c index 98df14358f4c..6f10b9f3c6d4 100644 --- a/contrib/awk/node.c +++ b/contrib/awk/node.c @@ -61,9 +61,9 @@ register NODE *n; return 0.0; cpend = cp + n->stlen; - while (cp < cpend && isspace((unsigned char)*cp)) + while (cp < cpend && isspace(*cp)) cp++; - if (cp == cpend || isalpha((unsigned char)*cp)) + if (cp == cpend || isalpha(*cp)) return 0.0; if (n->flags & MAYBE_NUM) { @@ -489,7 +489,7 @@ char **string_ptr; } if (do_posix) return ('x'); - if (! isxdigit((unsigned char)(*string_ptr)[0])) { + if (! isxdigit((*string_ptr)[0])) { warning("no hex digits in \\x escape sequence"); return ('x'); }