From 2e8744319d5e5e47799ec20b2f737c437e8c6398 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 5 Jun 2016 16:54:20 +0200 Subject: [PATCH] str_to_uofft is a tiny wrapper over strtoul{,l} --- src/core/misc.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/core/misc.c b/src/core/misc.c index 74ca4725..9081abe1 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -515,15 +515,11 @@ int dec2octal(int decimal) /* string -> uoff_t */ uoff_t str_to_uofft(const char *str) { - uoff_t ret; - - ret = 0; - while (*str != '\0') { - ret = ret*10 + (*str - '0'); - str++; - } - - return ret; +#ifdef UOFF_T_LONG_LONG + return (uoff_t)strtoull(str, NULL, 10); +#else + return (uoff_t)strtoul(str, NULL, 10); +#endif } /* convert all low-ascii (<32) to ^ combinations */