ref: fe896e5a49d5d6a1218f3389d2e6ca1a8b7c1228
parent: b91d539b8c273c086f7b3548700c429d2ad7c5d4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Sep 25 06:49:43 EDT 2017
[libc] Do not use () in ctype macros The parenthesis are unneded in this case because it is impossible to have any precedence problem in this context.
--- a/lib/c/include/ctype.h
+++ b/lib/c/include/ctype.h
@@ -30,17 +30,17 @@
extern unsigned char __ctype[];
extern int __ctmp;
-#define isalnum(c) ((__ctype+1)[(c)] & (_U|_L|_D))
-#define isalpha(c) ((__ctype+1)[(c)] & (_U|_L))
-#define iscntrl(c) ((__ctype+1)[(c)] & (_C))
-#define isdigit(c) ((__ctype+1)[(c)] & (_D))
-#define isgraph(c) ((__ctype+1)[(c)] & (_P|_U|_L|_D))
-#define islower(c) ((__ctype+1)[(c)] & (_L))
-#define isprint(c) ((__ctype+1)[(c)] & (_P|_U|_L|_D|_SP))
-#define ispunct(c) ((__ctype+1)[(c)] & (_P))
-#define isspace(c) ((__ctype+1)[(c)] & (_S))
-#define isupper(c) ((__ctype+1)[(c)] & (_U))
-#define isxdigit(c) ((__ctype+1)[(c)] & (_D|_X))
+#define isalnum(c) ((__ctype+1)[c] & (_U|_L|_D))
+#define isalpha(c) ((__ctype+1)[c] & (_U|_L))
+#define iscntrl(c) ((__ctype+1)[c] & (_C))
+#define isdigit(c) ((__ctype+1)[c] & (_D))
+#define isgraph(c) ((__ctype+1)[c] & (_P|_U|_L|_D))
+#define islower(c) ((__ctype+1)[c] & (_L))
+#define isprint(c) ((__ctype+1)[c] & (_P|_U|_L|_D|_SP))
+#define ispunct(c) ((__ctype+1)[c] & (_P))
+#define isspace(c) ((__ctype+1)[c] & (_S))
+#define isupper(c) ((__ctype+1)[c] & (_U))
+#define isxdigit(c) ((__ctype+1)[c] & (_D|_X))
#define tolower(c) ((__ctmp=c, isupper(__ctmp) ? __ctmp | 0x20 : __ctmp))
#define toupper(c) ((__ctmp=c, islower(__ctmp) ? __ctmp & ~0x20 : __ctmp))