diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ctype.h | 11 | ||||
-rw-r--r-- | include/wctype.h | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/ctype.h b/include/ctype.h index 4896d14f17..ae38b1bf23 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -68,4 +68,15 @@ __ctype_tolower_loc (void) # include <ctype/ctype.h> +# if !defined __NO_CTYPE && !defined NOT_IN_libc +/* The spec says that isdigit must only match the decimal digits. We + can check this without a memory access. */ +# undef isdigit +# define isdigit(c) ({ int __c = (c); __c >= '0' && __c <= '9'; }) +# undef isdigit_l +# define isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; }) +# undef __isdigit_l +# define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; }) +# endif + #endif /* ctype.h */ diff --git a/include/wctype.h b/include/wctype.h index a2d5e18f31..2828c3ad3d 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -84,4 +84,15 @@ libc_hidden_proto (__iswxdigit_l) libc_hidden_proto (__towlower_l) libc_hidden_proto (__towupper_l) +/* The spec says that isdigit must only match the decimal digits. We + can check this without a memory access. */ +# ifndef NOT_IN_libc +# undef iswdigit +# define iswdigit(c) ({ wint_t __c = (c); __c >= L'0' && __c <= L'9'; }) +# undef iswdigit_l +# define iswdigit_l(c, l) ({ wint_t __c = (c); __c >= L'0' && __c <= L'9'; }) +# undef __iswdigit_l +# define __iswdigit_l(c, l) ({ wint_t __c = (c); __c >= L'0' && __c <= L'9'; }) +# endif + #endif |