From 5efdfc50f50f62b3757a97dc91263d62a9e06b68 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 23 Apr 2019 00:55:05 +0100 Subject: [PATCH] tidy: mutt_str_atoi() --- mutt/string.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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; } -- 2.40.0