X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Fctype.h;h=32bcef4dabcce1b37d3ed009937abf5b48a074f9;hb=1ee8109ea01c4ac79e7932a533fead96309f80f3;hp=8ceaa9f9565b4d785789fb86422dc45c96c19872;hpb=419ae6d5c95629d3ebaff6f1880d52cb027ba924;p=musl diff --git a/include/ctype.h b/include/ctype.h index 8ceaa9f9..32bcef4d 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -5,6 +5,8 @@ extern "C" { #endif +#include + int isalnum(int); int isalpha(int); int isblank(int); @@ -20,13 +22,20 @@ 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) +#ifndef __cplusplus +static __inline int __isspace(int _c) +{ + return _c == ' ' || (unsigned)_c-'\t' < 5; +} +#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26) +#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10) +#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26) +#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26) +#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f) +#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e) +#define isspace(a) __isspace(a) +#endif #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ @@ -55,6 +64,9 @@ int isascii(int); int toascii(int); #define _tolower(a) ((a)|0x20) #define _toupper(a) ((a)&0x5f) +#ifndef __cplusplus +#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) +#endif #endif