diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-26 18:56:56 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-26 18:56:56 -0400 |
commit | 7e14ed1360c65b78c3ad1fc4fafea13e30067478 (patch) | |
tree | a8fc0c6d5245613962765857df15aa75acbafc64 /include/ctype.h | |
parent | 3bec53e0d3bb5e74d2e2dca34f50aadfaf832607 (diff) | |
download | musl-7e14ed1360c65b78c3ad1fc4fafea13e30067478.tar.gz musl-7e14ed1360c65b78c3ad1fc4fafea13e30067478.tar.bz2 musl-7e14ed1360c65b78c3ad1fc4fafea13e30067478.tar.xz musl-7e14ed1360c65b78c3ad1fc4fafea13e30067478.zip |
fix ctype macros to cast argument to (unsigned) first
issue reported by nsz, but it's actually not just pedantic. the
functions can take input of any arithmetic type, including floating
point, and the behavior needs to be as if the conversion implicit in
the function call took place.
Diffstat (limited to 'include/ctype.h')
-rw-r--r-- | include/ctype.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/ctype.h b/include/ctype.h index 97b9737c..a605d089 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -16,12 +16,12 @@ int isxdigit(int); int tolower(int); int toupper(int); -#define isalpha(a) ((unsigned)(((a)|32)-'a') < 26) -#define isdigit(a) ((unsigned)((a)-'0') < 10) -#define islower(a) ((unsigned)((a)-'a') < 26) -#define isupper(a) ((unsigned)((a)-'A') < 26) -#define isprint(a) ((unsigned)((a)-0x20) < 0x5f) -#define isgraph(a) ((unsigned)((a)-0x21) < 0x5e) +#define isalpha(a) ((((unsigned)(a)|32)-'a') < 26) +#define isdigit(a) (((unsigned)(a)-'0') < 10) +#define islower(a) (((unsigned)(a)-'a') < 26) +#define isupper(a) (((unsigned)(a)-'A') < 26) +#define isprint(a) (((unsigned)(a)-0x20) < 0x5f) +#define isgraph(a) (((unsigned)(a)-0x21) < 0x5e) |