summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-13 23:16:39 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-13 23:16:39 +0000
commitba900f2ae3e6e91810ced3c1838afee0332f016b (patch)
treec77761b4c78a61307edd9c183f415d4bf555d1b3 /lib/libc
parentf5810ab510bb5a455d9a8f4c469962383b15b487 (diff)
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.c8
-rw-r--r--lib/libc/gen/tolower_.c4
-rw-r--r--lib/libc/gen/toupper_.c4
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]);
}