summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-11-19 05:41:03 +0000
committerEric Andersen <andersen@codepoet.org>2002-11-19 05:41:03 +0000
commitba23f7118c09ca1807800882f1cf3661fa76dded (patch)
treeb2b48145b1b5c50ced8fb4e6e86c38a496a85c25
parent0a13130c4f2f3146f6994d47183ea460f08df32d (diff)
Aidan Van Dyk noticed that _toupper and _tolower were misbehaving.
This corrects them, per SuSv3.
-rw-r--r--include/ctype.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/ctype.h b/include/ctype.h
index 844689c3f..96ca2b61b 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -70,11 +70,11 @@ extern int isxupper(int c) __THROW; /* uClibc-specific. */
/* Now some non-ansi/iso c99 macros. */
-#define __isascii(c) (((unsigned int)(c)) <= 0x7f)
+#define __isascii(c) (((c) & ~0x7f) == 0)
#define __toascii(c) ((c) & 0x7f)
+#define _tolower(c) (isupper(c) ? tolower(c) : (c))
+#define _toupper(c) (islower(c) ? toupper(c) : (c))
-#define _toupper(c) ((c) | 0x20)
-#define _tolower(c) ((c) ^ 0x20)
/* For compatibility with older versions of uClibc. Are these ever used? */
#define __isxlower(c) __C_isxlower(c) /* uClibc-specific. */