blob: dbd62a1969f136650bf9372c59fbe27d92c1c90f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <stdlib.h>
#include <assert.h>
#include "memcached.h"
bool safe_strtoull(const char *str, unsigned long long *out) {
assert(out != NULL);
*out = 0;
char *endptr;
unsigned long long ull = strtoull(str, &endptr, 10);
if (*endptr == '\0' && endptr != str) {
*out = ull;
return true;
}
return false;
}
|