From: Richard Russon Date: Mon, 22 Apr 2019 23:55:05 +0000 (+0100) Subject: tidy: mutt_str_atoi() X-Git-Tag: 2019-10-25~242^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5efdfc50f50f62b3757a97dc91263d62a9e06b68;p=neomutt tidy: mutt_str_atoi() --- diff --git a/mutt/string.c b/mutt/string.c index 69a6336db..6f85c25fd 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -262,20 +262,19 @@ int mutt_str_atos(const char *str, short *dst) */ int mutt_str_atoi(const char *str, int *dst) { - int rc; - long res; - int tmp; - int *t = dst ? dst : &tmp; - - *t = 0; + if (dst) + *dst = 0; - rc = mutt_str_atol(str, &res); + long res = 0; + int rc = mutt_str_atol(str, &res); if (rc < 0) return rc; - if ((int) res != res) + if ((res < INT_MIN) || (res > INT_MAX)) return -2; - *t = (int) res; + if (dst) + *dst = (int) res; + return 0; }