X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Fctype.h;h=7936536f577c7d5ee5fd9257b8baad2fc491f4ec;hb=48be5b6313d7b827acf555769e93b389fa9f6307;hp=a85e907eb0fb36bdff696afd512522afdc0d6dce;hpb=3ed8c9f2df0b5f0bfe1006037c46d4f32ec6ca7b;p=musl diff --git a/include/ctype.h b/include/ctype.h index a85e907e..7936536f 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,17 +22,25 @@ 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) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ + || defined(_BSD_SOURCE) #define __NEED_locale_t #include @@ -54,6 +64,7 @@ int isascii(int); int toascii(int); #define _tolower(a) ((a)|0x20) #define _toupper(a) ((a)&0x5f) +#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128) #endif