ref: d0a1eae3c5e2d9b4fd2dd6d8727d882f24d4a4ef
parent: 51080ade62c1b8dbc93b8fa5e39c9db5233ef48d
author: Quentin Rameau <quinq@fifth.space>
date: Thu Mar 2 10:11:17 EST 2017
[libc] Fix isblank Obviously adding _TP was too much for a char, the solution is to have isblank as a function only.
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -27,13 +27,11 @@
#define _S 0x20 /* white space (space/lf/tab) */
#define _X 0x40 /* hex char */
#define _SP 0x80 /* hard space (0x20) */
-#define _TB 0x100 /* tabulation */
extern unsigned char _ctype[];
#define isalnum(c) (_ctype[(unsigned char) c] & (_U|_L|_D))
#define isalpha(c) (_ctype[(unsigned char) c] & (_U|_L))
-#define isblank(c) (_ctype[(unsigned char) c] & (_SP|_TB))
#define iscntrl(c) (_ctype[(unsigned char) c] & (_C))
#define isdigit(c) (_ctype[(unsigned char) c] & (_D))
#define isgraph(c) (_ctype[(unsigned char) c] & (_P|_U|_L|_D))
--- a/libc/src/ctype.c
+++ b/libc/src/ctype.c
@@ -5,7 +5,7 @@
unsigned char _ctype[255] = {
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
- _C,_C|_S|_TB,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
+ _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
--- a/libc/src/isblank.c
+++ b/libc/src/isblank.c
@@ -1,11 +1,7 @@
/* See LICENSE file for copyright and license details. */
-#define __USE_MACROS
-#include <ctype.h>
-#undef isblank
-
int
isblank(int c)
{
- return _ctype[(unsigned char) c] & (_SP|_TB);
+ return (c == ' ') || (c == '\t');
}