14 #include <memcached/util.h>
17 #define xisspace(c) isspace((unsigned char)c)
19 bool safe_strtoull(
const char *str, uint64_t *out) {
24 unsigned long long ull = strtoull(str, &endptr, 10);
27 if (xisspace(*endptr) || (*endptr ==
'\0' && endptr != str)) {
28 if ((
long long) ull < 0) {
32 if (strchr(str,
'-') != NULL) {
42 bool safe_strtoul(
const char *str, uint32_t *out) {
50 l = strtoul(str, &endptr, 10);
51 if (errno == ERANGE) {
55 if (xisspace(*endptr) || (*endptr ==
'\0' && endptr != str)) {
60 if (strchr(str,
'-') != NULL) {