summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ccan/str/debug.c2
-rw-r--r--ccan/str/str.h4
-rw-r--r--ccan/str/str_debug.h2
-rw-r--r--config.h1
-rw-r--r--tools/configurator/configurator.c3
5 files changed, 12 insertions, 0 deletions
diff --git a/ccan/str/debug.c b/ccan/str/debug.c
index 004a874f..9ef75676 100644
--- a/ccan/str/debug.c
+++ b/ccan/str/debug.c
@@ -24,11 +24,13 @@ int str_isascii(int i)
return isascii(i);
}
+#if HAVE_ISBLANK
int str_isblank(int i)
{
assert(i >= -1 && i < 256);
return isblank(i);
}
+#endif
int str_iscntrl(int i)
{
diff --git a/ccan/str/str.h b/ccan/str/str.h
index 293bba28..ae51cdcc 100644
--- a/ccan/str/str.h
+++ b/ccan/str/str.h
@@ -91,10 +91,12 @@ static inline bool cisascii(char c)
{
return isascii((unsigned char)c);
}
+#if HAVE_ISBLANK
static inline bool cisblank(char c)
{
return isblank((unsigned char)c);
}
+#endif
static inline bool ciscntrl(char c)
{
return iscntrl((unsigned char)c);
@@ -166,7 +168,9 @@ static inline bool cisxdigit(char c)
#define isalnum(i) str_isalnum(str_check_arg_(i))
#define isalpha(i) str_isalpha(str_check_arg_(i))
#define isascii(i) str_isascii(str_check_arg_(i))
+#if HAVE_ISBLANK
#define isblank(i) str_isblank(str_check_arg_(i))
+#endif
#define iscntrl(i) str_iscntrl(str_check_arg_(i))
#define isdigit(i) str_isdigit(str_check_arg_(i))
#define isgraph(i) str_isgraph(str_check_arg_(i))
diff --git a/ccan/str/str_debug.h b/ccan/str/str_debug.h
index 4545ccaa..6b564776 100644
--- a/ccan/str/str_debug.h
+++ b/ccan/str/str_debug.h
@@ -8,7 +8,9 @@
int str_isalnum(int i);
int str_isalpha(int i);
int str_isascii(int i);
+#if HAVE_ISBLANK
int str_isblank(int i);
+#endif
int str_iscntrl(int i);
int str_isdigit(int i);
int str_isgraph(int i);
diff --git a/config.h b/config.h
index 25609f13..f7dbc1f7 100644
--- a/config.h
+++ b/config.h
@@ -31,6 +31,7 @@
#define HAVE_FOR_LOOP_DECLARATION 0
#define HAVE_FLEXIBLE_ARRAY_MEMBER 1
#define HAVE_GETPAGESIZE 1
+#define HAVE_ISBLANK 1
#define HAVE_LITTLE_ENDIAN 1
#define HAVE_MEMMEM 1
#define HAVE_MMAP 1
diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c
index af7955a3..f1c7088f 100644
--- a/tools/configurator/configurator.c
+++ b/tools/configurator/configurator.c
@@ -102,6 +102,9 @@ static struct test tests[] = {
{ "HAVE_GETPAGESIZE", DEFINES_FUNC, NULL,
"#include <unistd.h>\n"
"static int func(void) { return getpagesize(); }" },
+ { "HAVE_ISBLANK", DEFINES_FUNC, NULL,
+ "#include <ctype.h>\n"
+ "static int func(void) { return isblank(' '); }" },
{ "HAVE_LITTLE_ENDIAN", INSIDE_MAIN|EXECUTE, NULL,
"union { int i; char c[sizeof(int)]; } u;\n"
"u.i = 0x01020304;\n"