diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2021-12-02 11:21:14 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2021-12-03 10:50:58 +0100 |
commit | dbc7d28ba9bee25fec59734695b31f70c6ecf2ff (patch) | |
tree | f1317f09589acf5719b175ceda7c7152ba635151 /newlib/libc/include | |
parent | 8dd641f23684683ad61cac140824c3f1ca0353bd (diff) | |
download | newlib-dbc7d28ba9bee25fec59734695b31f70c6ecf2ff.zip newlib-dbc7d28ba9bee25fec59734695b31f70c6ecf2ff.tar.gz newlib-dbc7d28ba9bee25fec59734695b31f70c6ecf2ff.tar.bz2 |
Revert "ctype: use less short names in public header"
This patch fixed a problem which isn't in newlib, but in projects
incorrectly using symbols from the reserved namespace.
This reverts commit 3ba1bd0d9dbc015c14a0aaafcef042f706d1249a.
Diffstat (limited to 'newlib/libc/include')
-rw-r--r-- | newlib/libc/include/ctype.h | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index 65ab24b..b29594a 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -57,17 +57,14 @@ extern int isascii_l (int __c, locale_t __l); extern int toascii_l (int __c, locale_t __l); #endif -enum -{ - _ISupper = 01, - _ISlower = 02, - _ISdigit = 04, - _ISspace = 010, - _ISpunct = 020, - _IScntrl = 040, - _ISxdigit = 0100, - _ISblank = 0200, -}; +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 /* For C++ backward-compatibility only. */ extern __IMPORT const char _ctype_[]; @@ -92,22 +89,22 @@ const char *__locale_ctype_ptr (void); an out-of-bounds reference on a 64-bit machine. */ #define __ctype_lookup(__c) ((__CTYPE_PTR+sizeof(""[__c]))[(int)(__c)]) -#define isalpha(__c) (__ctype_lookup(__c) & (_ISupper|_ISlower)) -#define isupper(__c) ((__ctype_lookup(__c) & (_ISupper|_ISlower)) == _ISupper) -#define islower(__c) ((__ctype_lookup(__c) & (_ISupper|_ISlower)) == _ISlower) -#define isdigit(__c) (__ctype_lookup(__c) & _ISdigit) -#define isxdigit(__c) (__ctype_lookup(__c) & (_ISxdigit|_ISdigit)) -#define isspace(__c) (__ctype_lookup(__c) & _ISspace) -#define ispunct(__c) (__ctype_lookup(__c) & _ISpunct) -#define isalnum(__c) (__ctype_lookup(__c) & (_ISupper|_ISlower|_ISdigit)) -#define isprint(__c) (__ctype_lookup(__c) & (_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank)) -#define isgraph(__c) (__ctype_lookup(__c) & (_ISpunct|_ISupper|_ISlower|_ISdigit)) -#define iscntrl(__c) (__ctype_lookup(__c) & _IScntrl) +#define isalpha(__c) (__ctype_lookup(__c)&(_U|_L)) +#define isupper(__c) ((__ctype_lookup(__c)&(_U|_L))==_U) +#define islower(__c) ((__ctype_lookup(__c)&(_U|_L))==_L) +#define isdigit(__c) (__ctype_lookup(__c)&_N) +#define isxdigit(__c) (__ctype_lookup(__c)&(_X|_N)) +#define isspace(__c) (__ctype_lookup(__c)&_S) +#define ispunct(__c) (__ctype_lookup(__c)&_P) +#define isalnum(__c) (__ctype_lookup(__c)&(_U|_L|_N)) +#define isprint(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N|_B)) +#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N)) +#define iscntrl(__c) (__ctype_lookup(__c)&_C) #if defined(__GNUC__) && __ISO_C_VISIBLE >= 1999 #define isblank(__c) \ __extension__ ({ __typeof__ (__c) __x = (__c); \ - (__ctype_lookup(__x)&_ISblank) || (int) (__x) == '\t';}) + (__ctype_lookup(__x)&_B) || (int) (__x) == '\t';}) #endif #if __POSIX_VISIBLE >= 200809 @@ -123,22 +120,22 @@ __locale_ctype_ptr_l(locale_t _l) #endif #define __ctype_lookup_l(__c,__l) ((__locale_ctype_ptr_l(__l)+sizeof(""[__c]))[(int)(__c)]) -#define isalpha_l(__c,__l) (__ctype_lookup_l(__c,__l) & (_ISupper|_ISlower)) -#define isupper_l(__c,__l) ((__ctype_lookup_l(__c,__l) & (_ISupper|_ISlower)) == _ISupper) -#define islower_l(__c,__l) ((__ctype_lookup_l(__c,__l) & (_ISupper|_ISlower)) == _ISlower) -#define isdigit_l(__c,__l) (__ctype_lookup_l(__c,__l) & _ISdigit) -#define isxdigit_l(__c,__l) (__ctype_lookup_l(__c,__l) & (_ISxdigit|_ISdigit)) -#define isspace_l(__c,__l) (__ctype_lookup_l(__c,__l) & _ISspace) -#define ispunct_l(__c,__l) (__ctype_lookup_l(__c,__l) & _ISpunct) -#define isalnum_l(__c,__l) (__ctype_lookup_l(__c,__l) & (_ISupper|_ISlower|_ISdigit)) -#define isprint_l(__c,__l) (__ctype_lookup_l(__c,__l) & (_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank)) -#define isgraph_l(__c,__l) (__ctype_lookup_l(__c,__l) & (_ISpunct|_ISupper|_ISlower|_ISdigit)) -#define iscntrl_l(__c,__l) (__ctype_lookup_l(__c,__l) & _IScntrl) +#define isalpha_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L)) +#define isupper_l(__c,__l) ((__ctype_lookup_l(__c,__l)&(_U|_L))==_U) +#define islower_l(__c,__l) ((__ctype_lookup_l(__c,__l)&(_U|_L))==_L) +#define isdigit_l(__c,__l) (__ctype_lookup_l(__c,__l)&_N) +#define isxdigit_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_X|_N)) +#define isspace_l(__c,__l) (__ctype_lookup_l(__c,__l)&_S) +#define ispunct_l(__c,__l) (__ctype_lookup_l(__c,__l)&_P) +#define isalnum_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L|_N)) +#define isprint_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_P|_U|_L|_N|_B)) +#define isgraph_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_P|_U|_L|_N)) +#define iscntrl_l(__c,__l) (__ctype_lookup_l(__c,__l)&_C) #if defined(__GNUC__) #define isblank_l(__c, __l) \ __extension__ ({ __typeof__ (__c) __x = (__c); \ - (__ctype_lookup_l(__x,__l)&_ISblank) || (int) (__x) == '\t';}) + (__ctype_lookup_l(__x,__l)&_B) || (int) (__x) == '\t';}) #endif #endif /* __POSIX_VISIBLE >= 200809 */ |