diff options
author | Paul Lindner <lindner@inuus.com> | 2010-01-01 21:47:30 -0800 |
---|---|---|
committer | Trond Norbye <trond.norbye@gmail.com> | 2010-09-14 08:58:41 +0200 |
commit | 39f6eeb3f50a25241da389b18f89a54daa659d50 (patch) | |
tree | 21f39a8bfc9cbbc2a4a7e1145e906a64f0ea915f /util.c | |
parent | b4936c4e94ea8929f10dcaa9563c105524fbcc12 (diff) | |
download | memcached-39f6eeb3f50a25241da389b18f89a54daa659d50.tar.gz |
Fix compilation issue on Solaris 9 wrt isspace() macro - Resolves issue 111
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -8,6 +8,9 @@ #include "memcached.h" +/* Avoid warnings on solaris, where isspace() is an index into an array, and gcc uses signed chars */ +#define xisspace(c) isspace((unsigned char)c) + bool safe_strtoull(const char *str, uint64_t *out) { assert(out != NULL); errno = 0; @@ -16,7 +19,7 @@ bool safe_strtoull(const char *str, uint64_t *out) { unsigned long long ull = strtoull(str, &endptr, 10); if (errno == ERANGE) return false; - if (isspace(*endptr) || (*endptr == '\0' && endptr != str)) { + if (xisspace(*endptr) || (*endptr == '\0' && endptr != str)) { if ((long long) ull < 0) { /* only check for negative signs in the uncommon case when * the unsigned number is so big that it's negative as a @@ -39,7 +42,7 @@ bool safe_strtoll(const char *str, int64_t *out) { long long ll = strtoll(str, &endptr, 10); if (errno == ERANGE) return false; - if (isspace(*endptr) || (*endptr == '\0' && endptr != str)) { + if (xisspace(*endptr) || (*endptr == '\0' && endptr != str)) { *out = ll; return true; } @@ -59,7 +62,7 @@ bool safe_strtoul(const char *str, uint32_t *out) { return false; } - if (isspace(*endptr) || (*endptr == '\0' && endptr != str)) { + if (xisspace(*endptr) || (*endptr == '\0' && endptr != str)) { if ((long) l < 0) { /* only check for negative signs in the uncommon case when * the unsigned number is so big that it's negative as a @@ -83,7 +86,7 @@ bool safe_strtol(const char *str, int32_t *out) { long l = strtol(str, &endptr, 10); if (errno == ERANGE) return false; - if (isspace(*endptr) || (*endptr == '\0' && endptr != str)) { + if (xisspace(*endptr) || (*endptr == '\0' && endptr != str)) { *out = l; return true; } |