summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-08-29 11:09:20 -0700
committerOri Bernstein <ori@eigenstate.org>2020-08-29 11:09:20 -0700
commitec533a1ad8403ae94db37774e78d5b371b8fecfc (patch)
tree45488e7cf77a079d680ffc9e73e1219bfdf9e5fa /sys/include
parent74bf624055abda1d4f6dfb986b0188a4102024f0 (diff)
ape/ctype.h: add isblank, fix functions (thanks staalmannen)
Our ctype.h mistakenly ommitted isblank. Add it in. While we're here, the make the 'isfoo()' functions are broken: they're offsetting into the array, and don't work with negative character values. Sync the function bodies with the macros, and make them produce correct results.
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/ape/ctype.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/include/ape/ctype.h b/sys/include/ape/ctype.h
index 1f36f4441..035c1821a 100644
--- a/sys/include/ape/ctype.h
+++ b/sys/include/ape/ctype.h
@@ -8,6 +8,7 @@ extern "C" {
extern int isalnum(int);
extern int isalpha(int);
+extern int isblank(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
@@ -38,6 +39,7 @@ enum
extern unsigned char _ctype[];
#define isalnum(c) (_ctype[(unsigned char)(c)]&(_ISupper|_ISlower|_ISdigit))
#define isalpha(c) (_ctype[(unsigned char)(c)]&(_ISupper|_ISlower))
+#define isblank(c) (_ctype[(unsigned char)(c)]&_ISblank)
#define iscntrl(c) (_ctype[(unsigned char)(c)]&_IScntrl)
#define isdigit(c) (_ctype[(unsigned char)(c)]&_ISdigit)
#define isgraph(c) (_ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit))