From: Timo Sirainen Date: Wed, 22 Oct 2025 11:27:51 +0000 (+0300) Subject: lib: str_to_*() - Fix compiler warnings X-Git-Tag: 2.4.2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b56c27d17538224b308d35ecb758449ffb4ae38b;p=thirdparty%2Fdovecot%2Fcore.git lib: str_to_*() - Fix compiler warnings Some gcc versions think endp may be uninitialized. --- diff --git a/src/lib/strnum.c b/src/lib/strnum.c index c16cfe017a..bd3cd50d90 100644 --- a/src/lib/strnum.c +++ b/src/lib/strnum.c @@ -111,7 +111,7 @@ int str_parse_uintmax(const char *str, uintmax_t *num_r, const char **endp_r) } int str_to_uintmax(const char *str, uintmax_t *num_r) { - const char *endp; + const char *endp = NULL; uintmax_t n; int ret = str_parse_uintmax(str, &n, &endp); if ((ret != 0) || (*endp != '\0')) @@ -206,7 +206,7 @@ int str_parse_uintmax_hex(const char *str, uintmax_t *num_r, } int str_to_uintmax_hex(const char *str, uintmax_t *num_r) { - const char *endp; + const char *endp = NULL; uintmax_t n; int ret = str_parse_uintmax_hex(str, &n, &endp); if ((ret != 0) || (*endp != '\0')) @@ -271,7 +271,7 @@ int str_parse_uintmax_oct(const char *str, uintmax_t *num_r, } int str_to_uintmax_oct(const char *str, uintmax_t *num_r) { - const char *endp; + const char *endp = NULL; uintmax_t n; int ret = str_parse_uintmax_oct(str, &n, &endp); if ((ret != 0) || (*endp != '\0')) @@ -346,7 +346,7 @@ str_parse_intmax(const char *str, intmax_t *num_r, const char **endp_r) } int str_to_intmax(const char *str, intmax_t *num_r) { - const char *endp; + const char *endp = NULL; intmax_t n; int ret = str_parse_intmax(str, &n, &endp); if ((ret != 0) || (*endp != '\0'))