[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android f2b2863ff73 2/2: ; Update from Gnulib
From: |
Po Lu |
Subject: |
feature/android f2b2863ff73 2/2: ; Update from Gnulib |
Date: |
Wed, 7 Jun 2023 21:30:01 -0400 (EDT) |
branch: feature/android
commit f2b2863ff7380e7c3c31662ca7615bd8edb83440
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
; Update from Gnulib
---
lib/getdelim.c | 4 ----
lib/vasnprintf.c | 28 ++++++++++++++++++++++------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/lib/getdelim.c b/lib/getdelim.c
index 79ec3dd12a3..e414df648f6 100644
--- a/lib/getdelim.c
+++ b/lib/getdelim.c
@@ -30,10 +30,6 @@
#include <stdlib.h>
#include <errno.h>
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
# define getc_maybe_unlocked(fp) getc(fp)
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 802790e14e4..63a6cd60f35 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -927,6 +927,14 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
return roomptr;
}
+/* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds
+ maximum object size 9223372036854775807", triggered by the use of xsum as
+ argument of malloc. */
+# if __GNUC__ >= 7
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Walloc-size-larger-than="
+# endif
+
/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal
representation.
Destroys the contents of a.
@@ -983,6 +991,10 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
return c_ptr;
}
+# if __GNUC__ >= 7
+# pragma GCC diagnostic pop
+# endif
+
# if NEED_PRINTF_LONG_DOUBLE
/* Assuming x is finite and >= 0:
@@ -1177,8 +1189,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 +1396,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 +1417,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