]> git.ozlabs.org Git - ccan/commitdiff
configure.h: HAVE_ISBLANK
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 28 Mar 2011 03:50:38 +0000 (14:20 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 28 Mar 2011 03:50:38 +0000 (14:20 +1030)
This isn't on RHEL4, for example: isascii() and isblank() are not in
C89.

ccan/str/debug.c
ccan/str/str.h
ccan/str/str_debug.h
config.h
tools/configurator/configurator.c

index 004a874f7c82778d93ff389d3b542ba0eb5ed9a6..9ef756766aa557b61e1ab4abeaaceba71900beaf 100644 (file)
@@ -24,11 +24,13 @@ int str_isascii(int i)
        return isascii(i);
 }
 
        return isascii(i);
 }
 
+#if HAVE_ISBLANK
 int str_isblank(int i)
 {
        assert(i >= -1 && i < 256);
        return isblank(i);
 }
 int str_isblank(int i)
 {
        assert(i >= -1 && i < 256);
        return isblank(i);
 }
+#endif
 
 int str_iscntrl(int i)
 {
 
 int str_iscntrl(int i)
 {
index 293bba282044551c98b2b4158aa84da832eb9886..ae51cdcc998e85b6a5014239bbd5cadc1bc9cda8 100644 (file)
@@ -91,10 +91,12 @@ static inline bool cisascii(char c)
 {
        return isascii((unsigned char)c);
 }
 {
        return isascii((unsigned char)c);
 }
+#if HAVE_ISBLANK
 static inline bool cisblank(char c)
 {
        return isblank((unsigned char)c);
 }
 static inline bool cisblank(char c)
 {
        return isblank((unsigned char)c);
 }
+#endif
 static inline bool ciscntrl(char c)
 {
        return iscntrl((unsigned char)c);
 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))
 #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))
 #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))
 #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))
index 4545ccaa3617088485c480a59f3a7367abfc9699..6b56477689efe31b0e622779a8a0130f45a6b2b2 100644 (file)
@@ -8,7 +8,9 @@
 int str_isalnum(int i);
 int str_isalpha(int i);
 int str_isascii(int i);
 int str_isalnum(int i);
 int str_isalpha(int i);
 int str_isascii(int i);
+#if HAVE_ISBLANK
 int str_isblank(int i);
 int str_isblank(int i);
+#endif
 int str_iscntrl(int i);
 int str_isdigit(int i);
 int str_isgraph(int i);
 int str_iscntrl(int i);
 int str_isdigit(int i);
 int str_isgraph(int i);
index 25609f136f4d9a0a9f4b8ac3999bd2a3366ec7b5..f7dbc1f7c46133124bc81537a1025e25557992e3 100644 (file)
--- 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_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
 #define HAVE_LITTLE_ENDIAN 1
 #define HAVE_MEMMEM 1
 #define HAVE_MMAP 1
index af7955a3144449db4cb1d04fc82454c40558a8ae..f1c7088fbc1b33f22a7372ded823049144871059 100644 (file)
@@ -102,6 +102,9 @@ static struct test tests[] = {
        { "HAVE_GETPAGESIZE", DEFINES_FUNC, NULL,
          "#include <unistd.h>\n"
          "static int func(void) { return getpagesize(); }" },
        { "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"
        { "HAVE_LITTLE_ENDIAN", INSIDE_MAIN|EXECUTE, NULL,
          "union { int i; char c[sizeof(int)]; } u;\n"
          "u.i = 0x01020304;\n"