summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjorn Granlund <tg@gmplib.org>2016-08-29 16:48:20 +0200
committerTorbjorn Granlund <tg@gmplib.org>2016-08-29 16:48:20 +0200
commit9deac7786c2eebbb7bdb805a544e7f7f0f3f86d3 (patch)
treeae5c0ede128c654a480e12668b60b5625b409854
parentd6b531d0501182336bed7d7c799fee506c756867 (diff)
downloadgmp-9deac7786c2eebbb7bdb805a544e7f7f0f3f86d3.tar.gz
Use __GMP_ALLOCATE_FUNC_TYPE and friends.
-rw-r--r--ChangeLog10
-rw-r--r--mpf/get_str.c2
-rw-r--r--mpf/inp_str.c6
-rw-r--r--mpq/get_str.c2
-rw-r--r--mpz/get_str.c2
-rw-r--r--mpz/inp_str.c4
-rw-r--r--scanf/vsscanf.c2
-rw-r--r--tal-reent.c2
8 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index bdc173647..fa1f03452 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-08-29 Torbjörn Granlund <tg@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@synopsys.com>
* longlong.h (arc add_ssaaaa, sub_ddmmss): Replace obsolete 'J'
diff --git a/mpf/get_str.c b/mpf/get_str.c
index 682819daa..0bfd99fe4 100644
--- a/mpf/get_str.c
+++ b/mpf/get_str.c
@@ -170,7 +170,7 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
/* 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 --git a/mpf/inp_str.c b/mpf/inp_str.c
index 45cc34ceb..3db589705 100644
--- a/mpf/inp_str.c
+++ b/mpf/inp_str.c
@@ -47,7 +47,7 @@ mpf_inp_str (mpf_ptr rop, FILE *stream, int base)
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 @@ mpf_inp_str (mpf_ptr rop, FILE *stream, int base)
{
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 @@ mpf_inp_str (mpf_ptr rop, FILE *stream, int base)
{
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 --git a/mpq/get_str.c b/mpq/get_str.c
index 8fa0de1cd..0abfb6e02 100644
--- a/mpq/get_str.c
+++ b/mpq/get_str.c
@@ -51,7 +51,7 @@ mpq_get_str (char *str, int base, mpq_srcptr q)
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 --git a/mpz/get_str.c b/mpz/get_str.c
index 08c7cd737..e64d1ab49 100644
--- a/mpz/get_str.c
+++ b/mpz/get_str.c
@@ -78,7 +78,7 @@ mpz_get_str (char *res_str, int base, mpz_srcptr x)
/* 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 --git a/mpz/inp_str.c b/mpz/inp_str.c
index 474bc6843..a71bf2f97 100644
--- a/mpz/inp_str.c
+++ b/mpz/inp_str.c
@@ -132,7 +132,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
}
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 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
{
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 --git a/scanf/vsscanf.c b/scanf/vsscanf.c
index 6fb043dce..a5c1cb4e8 100644
--- a/scanf/vsscanf.c
+++ b/scanf/vsscanf.c
@@ -48,7 +48,7 @@ gmp_vsscanf (const char *s, const char *fmt, va_list ap)
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 --git a/tal-reent.c b/tal-reent.c
index 92f516b5f..7818af825 100644
--- a/tal-reent.c
+++ b/tal-reent.c
@@ -61,7 +61,7 @@ __gmp_tmp_reentrant_alloc (struct tmp_reentrant_t **markp, size_t size)
#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;