Feature test macros overhaul: ctype.h
Simplify C99 test for isblank. isascii and toascii are BSD|SVID|XSI. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
parent
6ba26630e0
commit
575608b202
|
@ -2,6 +2,7 @@
|
||||||
#define _CTYPE_H_
|
#define _CTYPE_H_
|
||||||
|
|
||||||
#include "_ansi.h"
|
#include "_ansi.h"
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
_BEGIN_STD_C
|
_BEGIN_STD_C
|
||||||
|
|
||||||
|
@ -19,11 +20,11 @@ int _EXFUN(isxdigit,(int __c));
|
||||||
int _EXFUN(tolower, (int __c));
|
int _EXFUN(tolower, (int __c));
|
||||||
int _EXFUN(toupper, (int __c));
|
int _EXFUN(toupper, (int __c));
|
||||||
|
|
||||||
#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
|
#if __ISO_C_VISIBLE >= 1999
|
||||||
int _EXFUN(isblank, (int __c));
|
int _EXFUN(isblank, (int __c));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __STRICT_ANSI__
|
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||||
int _EXFUN(isascii, (int __c));
|
int _EXFUN(isascii, (int __c));
|
||||||
int _EXFUN(toascii, (int __c));
|
int _EXFUN(toascii, (int __c));
|
||||||
#define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a')
|
#define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a')
|
||||||
|
@ -68,8 +69,7 @@ extern __IMPORT char *__ctype_ptr__;
|
||||||
#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N))
|
#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N))
|
||||||
#define iscntrl(__c) (__ctype_lookup(__c)&_C)
|
#define iscntrl(__c) (__ctype_lookup(__c)&_C)
|
||||||
|
|
||||||
#if defined(__GNUC__) && \
|
#if defined(__GNUC__) && __ISO_C_VISIBLE >= 1999
|
||||||
(!defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901L)
|
|
||||||
#define isblank(__c) \
|
#define isblank(__c) \
|
||||||
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
__extension__ ({ __typeof__ (__c) __x = (__c); \
|
||||||
(__ctype_lookup(__x)&_B) || (int) (__x) == '\t';})
|
(__ctype_lookup(__x)&_B) || (int) (__x) == '\t';})
|
||||||
|
@ -98,13 +98,14 @@ extern __IMPORT char *__ctype_ptr__;
|
||||||
(void) __ctype_ptr__[__x]; (tolower) (__x);})
|
(void) __ctype_ptr__[__x]; (tolower) (__x);})
|
||||||
# endif /* _MB_EXTENDED_CHARSETS* */
|
# endif /* _MB_EXTENDED_CHARSETS* */
|
||||||
# endif /* __GNUC__ */
|
# endif /* __GNUC__ */
|
||||||
#endif /* !__cplusplus */
|
|
||||||
|
|
||||||
#ifndef __STRICT_ANSI__
|
#if __MISC_VISIBLE || __XSI_VISIBLE
|
||||||
#define isascii(__c) ((unsigned)(__c)<=0177)
|
#define isascii(__c) ((unsigned)(__c)<=0177)
|
||||||
#define toascii(__c) ((__c)&0177)
|
#define toascii(__c) ((__c)&0177)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* !__cplusplus */
|
||||||
|
|
||||||
/* For C++ backward-compatibility only. */
|
/* For C++ backward-compatibility only. */
|
||||||
extern __IMPORT _CONST char _ctype_[];
|
extern __IMPORT _CONST char _ctype_[];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue