From: Richard Russon Date: Tue, 23 Apr 2019 00:45:38 +0000 (+0100) Subject: tidy: mutt_str_atoull() X-Git-Tag: 2019-10-25~242^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8ba68d147f0f8ac254070a5c21e6b6a070550d2;p=neomutt tidy: mutt_str_atoull() --- diff --git a/mutt/string.c b/mutt/string.c index 4b1612716..87c83fa18 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -352,20 +352,19 @@ int mutt_str_atoul(const char *str, unsigned long *dst) */ int mutt_str_atoull(const char *str, unsigned long long *dst) { - unsigned long long r; - unsigned long long *res = dst ? dst : &r; - char *e = NULL; + if (dst) + *dst = 0; - /* no input: 0 */ - if (!str || !*str) - { - *res = 0; + if (!str || !*str) /* no input: 0 */ return 0; - } + char *e = NULL; errno = 0; - *res = strtoull(str, &e, 10); - if ((*res == ULLONG_MAX) && (errno == ERANGE)) + + unsigned long long res = strtoull(str, &e, 10); + if (dst) + *dst = res; + if ((res == ULLONG_MAX) && (errno == ERANGE)) return -1; if (e && (*e != '\0')) return 1;