diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-07 17:40:25 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-07 17:40:25 +0200 |
commit | 8f75a603ec833a07a9d9d05782713807297c0c53 (patch) | |
tree | f3ef6a0dd8725be483e6c3dfdfc27b3cc6099117 /src/util.c | |
parent | afe1be4dbdf142513f6ac1d92e6a20bdc4b20c80 (diff) |
util: implement safe_atolu based on safe_atolli/safe_atoi, depending on word size
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/util.c b/src/util.c index a5f904dbfd..8360eb68fd 100644 --- a/src/util.c +++ b/src/util.c @@ -307,40 +307,6 @@ int safe_atoi(const char *s, int *ret_i) { return 0; } -int safe_atolu(const char *s, long unsigned *ret_lu) { - char *x = NULL; - unsigned long l; - - assert(s); - assert(ret_lu); - - errno = 0; - l = strtoul(s, &x, 0); - - if (!x || *x || errno) - return errno ? -errno : -EINVAL; - - *ret_lu = l; - return 0; -} - -int safe_atoli(const char *s, long int *ret_li) { - char *x = NULL; - long l; - - assert(s); - assert(ret_li); - - errno = 0; - l = strtol(s, &x, 0); - - if (!x || *x || errno) - return errno ? -errno : -EINVAL; - - *ret_li = l; - return 0; -} - int safe_atollu(const char *s, long long unsigned *ret_llu) { char *x = NULL; unsigned long long l; |