diff options
Diffstat (limited to 'Build/source/libs/gmp/gmp-src/mpz/inp_str.c')
-rw-r--r-- | Build/source/libs/gmp/gmp-src/mpz/inp_str.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Build/source/libs/gmp/gmp-src/mpz/inp_str.c b/Build/source/libs/gmp/gmp-src/mpz/inp_str.c index 474bc68435f..0756055be02 100644 --- a/Build/source/libs/gmp/gmp-src/mpz/inp_str.c +++ b/Build/source/libs/gmp/gmp-src/mpz/inp_str.c @@ -36,7 +36,6 @@ see https://www.gnu.org/licenses/. */ #include <stdio.h> #include <ctype.h> -#include "gmp.h" #include "gmp-impl.h" #include "longlong.h" @@ -84,7 +83,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread) /* For bases > 36, use the collating sequence 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. */ digit_value += 208; - if (base > 62) + if (UNLIKELY (base > 62)) return 0; /* too large base */ } @@ -132,7 +131,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 +144,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); @@ -163,7 +162,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread) else { LIMBS_PER_DIGIT_IN_BASE (xsize, str_size, base); - MPZ_REALLOC (x, xsize); + MPZ_NEWALLOC (x, xsize); /* Convert the byte array in base BASE to our bignum format. */ xsize = mpn_set_str (PTR (x), (unsigned char *) str, str_size, base); |