[Gmp-commit] /var/hg/gmp: Use __GMP_ALLOCATE_FUNC_TYPE and friends.
mercurial at gmplib.org
mercurial at gmplib.org
Mon Aug 29 14:48:22 UTC 2016
details: /var/hg/gmp/rev/adddc0925487
changeset: 17072:adddc0925487
user: Torbjorn Granlund <tg at gmplib.org>
date: Mon Aug 29 16:48:20 2016 +0200
description:
Use __GMP_ALLOCATE_FUNC_TYPE and friends.
diffstat:
ChangeLog | 10 ++++++++++
mpf/get_str.c | 2 +-
mpf/inp_str.c | 6 +++---
mpq/get_str.c | 2 +-
mpz/get_str.c | 2 +-
mpz/inp_str.c | 4 ++--
scanf/vsscanf.c | 2 +-
tal-reent.c | 2 +-
8 files changed, 20 insertions(+), 10 deletions(-)
diffs (128 lines):
diff -r 58879634af3c -r adddc0925487 ChangeLog
--- a/ChangeLog Thu Aug 25 00:00:43 2016 +0200
+++ b/ChangeLog Mon Aug 29 16:48:20 2016 +0200
@@ -1,3 +1,13 @@
+2016-08-29 Torbjörn Granlund <tg at gmplib.org>
+
+ * mpf/get_str.c: Use __GMP_ALLOCATE_FUNC_TYPE and friends.
+ * mpf/inp_str.c: Likewise.
+ * mpq/get_str.c: Likewise.
+ * mpz/get_str.c: Likewise.
+ * mpz/inp_str.c: Likewise.
+ * scanf/vsscanf.c: Likewise.
+ * tal-reent.c: Likewise.
+
2016-08-24 Vlad Zakharov <vzakhar at synopsys.com>
* longlong.h (arc add_ssaaaa, sub_ddmmss): Replace obsolete 'J'
diff -r 58879634af3c -r adddc0925487 mpf/get_str.c
--- a/mpf/get_str.c Thu Aug 25 00:00:43 2016 +0200
+++ b/mpf/get_str.c Mon Aug 29 16:48:20 2016 +0200
@@ -170,7 +170,7 @@
/* We didn't get a string from the user. Allocate one (and return
a pointer to it) with space for `-' and terminating null. */
alloc_size = n_digits + 2;
- dbuf = (char *) (*__gmp_allocate_func) (n_digits + 2);
+ dbuf = __GMP_ALLOCATE_FUNC_TYPE (n_digits + 2, char);
}
if (un == 0)
diff -r 58879634af3c -r adddc0925487 mpf/inp_str.c
--- a/mpf/inp_str.c Thu Aug 25 00:00:43 2016 +0200
+++ b/mpf/inp_str.c Mon Aug 29 16:48:20 2016 +0200
@@ -47,7 +47,7 @@
stream = stdin;
alloc_size = 100;
- str = (char *) (*__gmp_allocate_func) (alloc_size);
+ str = __GMP_ALLOCATE_FUNC_TYPE (alloc_size, char);
str_size = 0;
nread = 0;
@@ -65,7 +65,7 @@
{
size_t old_alloc_size = alloc_size;
alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ str = __GMP_REALLOCATE_FUNC_TYPE (str, old_alloc_size, alloc_size, char);
}
if (c == EOF || isspace (c))
break;
@@ -79,7 +79,7 @@
{
size_t old_alloc_size = alloc_size;
alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ str = __GMP_REALLOCATE_FUNC_TYPE (str, old_alloc_size, alloc_size, char);
}
str[str_size] = 0;
diff -r 58879634af3c -r adddc0925487 mpq/get_str.c
--- a/mpq/get_str.c Thu Aug 25 00:00:43 2016 +0200
+++ b/mpq/get_str.c Mon Aug 29 16:48:20 2016 +0200
@@ -51,7 +51,7 @@
DIGITS_IN_BASE_PER_LIMB (str_alloc, ABSIZ(NUM(q)) + SIZ(DEN(q)), ABS(base));
str_alloc += 6;
- str = (char *) (*__gmp_allocate_func) (str_alloc);
+ str = __GMP_ALLOCATE_FUNC_TYPE (str_alloc, char);
}
mpz_get_str (str, base, mpq_numref(q));
diff -r 58879634af3c -r adddc0925487 mpz/get_str.c
--- a/mpz/get_str.c Thu Aug 25 00:00:43 2016 +0200
+++ b/mpz/get_str.c Mon Aug 29 16:48:20 2016 +0200
@@ -78,7 +78,7 @@
/* digits, null terminator, possible minus sign */
MPN_SIZEINBASE (alloc_size, PTR(x), ABS(x_size), base);
alloc_size += 1 + (x_size<0);
- res_str = (char *) (*__gmp_allocate_func) (alloc_size);
+ res_str = __GMP_ALLOCATE_FUNC_TYPE (alloc_size, char);
}
return_str = res_str;
diff -r 58879634af3c -r adddc0925487 mpz/inp_str.c
--- a/mpz/inp_str.c Thu Aug 25 00:00:43 2016 +0200
+++ b/mpz/inp_str.c Mon Aug 29 16:48:20 2016 +0200
@@ -132,7 +132,7 @@
}
alloc_size = 100;
- str = (char *) (*__gmp_allocate_func) (alloc_size);
+ str = __GMP_ALLOCATE_FUNC_TYPE (alloc_size, char);
str_size = 0;
while (c != EOF)
@@ -145,7 +145,7 @@
{
size_t old_alloc_size = alloc_size;
alloc_size = alloc_size * 3 / 2;
- str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ str = __GMP_REALLOCATE_FUNC_TYPE (str, old_alloc_size, alloc_size, char);
}
str[str_size++] = dig;
c = getc (stream);
diff -r 58879634af3c -r adddc0925487 scanf/vsscanf.c
--- a/scanf/vsscanf.c Thu Aug 25 00:00:43 2016 +0200
+++ b/scanf/vsscanf.c Mon Aug 29 16:48:20 2016 +0200
@@ -48,7 +48,7 @@
char *alloc;
int ret;
size = strlen (s) + 1;
- alloc = (char *) (*__gmp_allocate_func) (size);
+ alloc = __GMP_ALLOCATE_FUNC_TYPE (size, char);
memcpy (alloc, s, size);
s = alloc;
ret = __gmp_doscan (&__gmp_sscanf_funs, (void *) &s, fmt, ap);
diff -r 58879634af3c -r adddc0925487 tal-reent.c
--- a/tal-reent.c Thu Aug 25 00:00:43 2016 +0200
+++ b/tal-reent.c Mon Aug 29 16:48:20 2016 +0200
@@ -61,7 +61,7 @@
#define P ((struct tmp_reentrant_t *) p)
total_size = size + HSIZ;
- p = (char *) (*__gmp_allocate_func) (total_size);
+ p = __GMP_ALLOCATE_FUNC_TYPE (total_size, char);
P->size = total_size;
P->next = *markp;
*markp = P;
More information about the gmp-commit
mailing list