diff options
author | Brad Fitzpatrick <brad@danga.com> | 2008-10-14 21:03:05 -0700 |
---|---|---|
committer | Dustin Sallings <dustin@spy.net> | 2009-03-19 01:52:53 -0700 |
commit | 420aa2d992093b78c1bba6cbb3577d5b53a19ec8 (patch) | |
tree | b465c4262e27303f5178350f1a7d8239b864c1eb /util.c | |
parent | 9791d32edaa99d2cb3825c2e526b066a6cbe2e4c (diff) | |
download | memcached-420aa2d992093b78c1bba6cbb3577d5b53a19ec8.tar.gz |
start of the incr fix, rearranges a bunch, adds util, tests, etc
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,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; +} |