diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-14 02:34:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-12-14 02:34:40 +0000 |
commit | 7f8908bfd3dc346053bf4393426ead713a46733c (patch) | |
tree | 69ccdfdb43e0d349662c07f3683e8e7ff0df60c8 /lib | |
parent | 647e702ab1e144e85bb22b5068cfce9bf9827b6a (diff) |
Instead of doing "if (c == EOF) return 0;" use the hook ('?') operator
instead to make these one-liners. Works around a compiler bug on vax
that affects both the libc and inline versions identically.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/isctype.c | 48 |
1 files changed, 13 insertions, 35 deletions
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 |