diff --git a/sys/sys/ctype_inline.h b/sys/sys/ctype_inline.h index d416a4591..105cdcb2c 100644 --- a/sys/sys/ctype_inline.h +++ b/sys/sys/ctype_inline.h @@ -44,20 +44,20 @@ #include #include -/* LSC: cast to unsigned char in order to prevent char as indice errors. */ -#define isdigit(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_N)) -#define islower(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_L)) -#define isspace(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_S)) -#define ispunct(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_P)) -#define isupper(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_U)) -#define isalpha(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_U|_CTYPE_L))) -#define isxdigit(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_N|_CTYPE_X))) -#define isalnum(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_U|_CTYPE_L|_CTYPE_N))) -#define isprint(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B))) -#define isgraph(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N))) -#define iscntrl(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_C)) -#define tolower(c) ((int)((_tolower_tab_ + 1)[(unsigned char)(c)])) -#define toupper(c) ((int)((_toupper_tab_ + 1)[(unsigned char)(c)])) + +#define isdigit(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_N)) +#define islower(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_L)) +#define isspace(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_S)) +#define ispunct(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_P)) +#define isupper(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_U)) +#define isalpha(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_U|_CTYPE_L))) +#define isxdigit(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_N|_CTYPE_X))) +#define isalnum(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_U|_CTYPE_L|_CTYPE_N))) +#define isprint(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B))) +#define isgraph(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N))) +#define iscntrl(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_C)) +#define tolower(c) ((int)((_tolower_tab_ + 1)[(c)])) +#define toupper(c) ((int)((_toupper_tab_ + 1)[(c)])) #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) #define isascii(c) ((unsigned)(c) <= 0177)