diff options
-rw-r--r-- | include/ctype.h | 46 | ||||
-rw-r--r-- | lib/libc/gen/isctype.c | 48 |
2 files changed, 25 insertions, 69 deletions
diff --git a/include/ctype.h b/include/ctype.h index 1845aa1e978..7317a17bec2 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctype.h,v 1.7 2002/12/13 23:16:38 millert Exp $ */ +/* $OpenBSD: ctype.h,v 1.8 2002/12/14 02:34:38 millert Exp $ */ /* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */ /* @@ -89,79 +89,57 @@ __END_DECLS static __inline int isalnum(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & (_U|_L|_N)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_U|_L|_N)); } static __inline int isalpha(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & (_U|_L)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_U|_L)); } static __inline int iscntrl(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & _C); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _C); } static __inline int isdigit(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & _N); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _N); } static __inline int isgraph(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N)); } static __inline int islower(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & _L); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _L); } static __inline int isprint(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N|_B)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N|_B)); } static __inline int ispunct(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & _P); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _P); } static __inline int isspace(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & _S); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _S); } static __inline int isupper(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & _U); + return (c == EOF ? : (_ctype_ + 1)[(unsigned int)c] & _U); } static __inline int isxdigit(int c) { - if (c == EOF) - return (0); - return ((_ctype_ + 1)[(unsigned int)c] & (_N|_X)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_N|_X)); } static __inline int tolower(int c) diff --git a/lib/libc/gen/isctype.c b/lib/libc/gen/isctype.c index e6df7d94354..4202b5acbe5 100644 --- a/lib/libc/gen/isctype.c +++ b/lib/libc/gen/isctype.c @@ -37,7 +37,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: isctype.c,v 1.5 2002/12/13 23:16:38 millert Exp $"; +static char rcsid[] = "$OpenBSD: isctype.c,v 1.6 2002/12/14 02:34:39 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #define _ANSI_LIBRARY @@ -49,9 +49,7 @@ int isalnum(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & (_U|_L|_N)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_U|_L|_N)); } #undef isalpha @@ -59,9 +57,7 @@ int isalpha(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & (_U|_L)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_U|_L)); } #undef isblank @@ -69,7 +65,7 @@ int isblank(c) int c; { - return(c == ' ' || c == '\t'); + return (c == ' ' || c == '\t'); } #undef iscntrl @@ -77,9 +73,7 @@ int iscntrl(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & _C); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _C); } #undef isdigit @@ -87,9 +81,7 @@ int isdigit(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & _N); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _N); } #undef isgraph @@ -97,9 +89,7 @@ int isgraph(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N)); } #undef islower @@ -107,9 +97,7 @@ int islower(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & _L); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _L); } #undef isprint @@ -117,9 +105,7 @@ int isprint(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N|_B)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_P|_U|_L|_N|_B)); } #undef ispunct @@ -127,9 +113,7 @@ int ispunct(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & _P); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _P); } #undef isspace @@ -137,9 +121,7 @@ int isspace(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & _S); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _S); } #undef isupper @@ -147,9 +129,7 @@ int isupper(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & _U); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & _U); } #undef isxdigit @@ -157,9 +137,7 @@ int isxdigit(c) int c; { - if (c == EOF) - return(0); - return((_ctype_ + 1)[(unsigned int)c] & (_N|_X)); + return (c == EOF ? 0 : (_ctype_ + 1)[(unsigned int)c] & (_N|_X)); } #undef isascii |