From: Bruno Haible Date: Thu, 18 May 2023 20:51:17 +0000 (+0200) Subject: vasnprintf, c-vasnprintf: Silence gcc warnings. X-Git-Tag: v1.0~1315 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a654869530ca6fd6cf45f9e1f8257362b1100f7e;p=gnulib.git vasnprintf, c-vasnprintf: Silence gcc warnings. * lib/vasnprintf.c (scale10_round_decimal_decoded): Remove memory==NULL test. (scale10_round_decimal_long_double, scale10_round_decimal_double): Test for memory==NULL here. Remove use of IF_LINT. --- diff --git a/ChangeLog b/ChangeLog index 1796c625ee..ee9a35da35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-05-18 Bruno Haible + + vasnprintf, c-vasnprintf: Silence gcc warnings. + * lib/vasnprintf.c (scale10_round_decimal_decoded): Remove memory==NULL + test. + (scale10_round_decimal_long_double, scale10_round_decimal_double): Test + for memory==NULL here. Remove use of IF_LINT. + 2023-05-18 Bruno Haible bitset: Silence gcc warning. diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index 802790e14e..007d280980 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -1177,8 +1177,6 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) void *z_memory; char *digits; - if (memory == NULL) - return NULL; /* x = 2^e * m, hence y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) = round (2^s * 5^n * m). */ @@ -1386,10 +1384,13 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) static char * scale10_round_decimal_long_double (long double x, int n) { - int e IF_LINT(= 0); + int e; mpn_t m; void *memory = decode_long_double (x, &e, &m); - return scale10_round_decimal_decoded (e, m, memory, n); + if (memory != NULL) + return scale10_round_decimal_decoded (e, m, memory, n); + else + return NULL; } # endif @@ -1404,10 +1405,13 @@ scale10_round_decimal_long_double (long double x, int n) static char * scale10_round_decimal_double (double x, int n) { - int e IF_LINT(= 0); + int e; mpn_t m; void *memory = decode_double (x, &e, &m); - return scale10_round_decimal_decoded (e, m, memory, n); + if (memory != NULL) + return scale10_round_decimal_decoded (e, m, memory, n); + else + return NULL; } # endif