diff options
| author | 2002-12-13 23:16:38 +0000 | |
|---|---|---|
| committer | 2002-12-13 23:16:38 +0000 | |
| commit | 33f9814b7ea62c13bad061751915a824f5d44949 (patch) | |
| tree | fa1cbd222eedb57d46037f3c8d93da23a346181a /lib/libc | |
| parent | ansi & knf (diff) | |
| download | wireguard-openbsd-33f9814b7ea62c13bad061751915a824f5d44949.tar.xz wireguard-openbsd-33f9814b7ea62c13bad061751915a824f5d44949.zip | |
Less stupid check for 7-bit ascii in toupper/tolower
Remove useless check for EOF in isascii
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/isctype.c | 8 | ||||
| -rw-r--r-- | lib/libc/gen/tolower_.c | 4 | ||||
| -rw-r--r-- | lib/libc/gen/toupper_.c | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/lib/libc/gen/isctype.c b/lib/libc/gen/isctype.c index 585fcef9d27..e6df7d94354 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.4 2002/12/13 22:39:27 millert Exp $"; +static char rcsid[] = "$OpenBSD: isctype.c,v 1.5 2002/12/13 23:16:38 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #define _ANSI_LIBRARY @@ -167,9 +167,7 @@ int isascii(c) int c; { - if (c == EOF) - return(0); - return ((unsigned int)(c) <= 0177); + return ((unsigned int)c <= 0177); } #undef toascii @@ -177,7 +175,7 @@ int toascii(c) int c; { - return ((c) & 0177); + return (c & 0177); } #undef _toupper diff --git a/lib/libc/gen/tolower_.c b/lib/libc/gen/tolower_.c index 2e116613944..c74d1725fb2 100644 --- a/lib/libc/gen/tolower_.c +++ b/lib/libc/gen/tolower_.c @@ -4,7 +4,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: tolower_.c,v 1.5 2002/12/13 22:39:27 millert Exp $"; +static char rcsid[] = "$OpenBSD: tolower_.c,v 1.6 2002/12/13 23:16:38 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #define _ANSI_LIBRARY @@ -54,7 +54,7 @@ int tolower(c) int c; { - if (c != (c & 0177)) + if ((unsigned int)c > 0177) return(c); return((_tolower_tab_ + 1)[c]); } diff --git a/lib/libc/gen/toupper_.c b/lib/libc/gen/toupper_.c index d5e9b98dcf7..fa2fc4fd996 100644 --- a/lib/libc/gen/toupper_.c +++ b/lib/libc/gen/toupper_.c @@ -4,7 +4,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: toupper_.c,v 1.5 2002/12/13 22:39:27 millert Exp $"; +static char rcsid[] = "$OpenBSD: toupper_.c,v 1.6 2002/12/13 23:16:38 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #define _ANSI_LIBRARY @@ -54,7 +54,7 @@ int toupper(c) int c; { - if (c != (c & 0177)) + if ((unsigned int)c > 0177) return(c); return((_toupper_tab_ + 1)[c]); } |
