diff options
author | Torbjorn Granlund <tege@gmplib.org> | 2012-05-26 15:57:43 +0200 |
---|---|---|
committer | Torbjorn Granlund <tege@gmplib.org> | 2012-05-26 15:57:43 +0200 |
commit | eb3632bb2177f6ea7d2f41c9722458c10159c013 (patch) | |
tree | 624a47bf95ce22460938a693f797937f5d6003cb /mpz/rrandomb.c | |
parent | 27ac5bf5c349d49c7103674b4a366afb6ad51cca (diff) | |
download | gmp-eb3632bb2177f6ea7d2f41c9722458c10159c013.tar.gz |
Use MPZ_REALLOC return value when possible.
Diffstat (limited to 'mpz/rrandomb.c')
-rw-r--r-- | mpz/rrandomb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mpz/rrandomb.c b/mpz/rrandomb.c index 0bd031cb2..3e06e2c70 100644 --- a/mpz/rrandomb.c +++ b/mpz/rrandomb.c @@ -2,7 +2,7 @@ long runs of consecutive ones and zeros in the binary representation. Meant for testing of other MP routines. -Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc. +Copyright 2000, 2001, 2002, 2004, 2012 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -28,12 +28,13 @@ void mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, mp_bitcnt_t nbits) { mp_size_t nl; + mp_ptr xp; nl = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS; if (nbits != 0) { - MPZ_REALLOC (x, nl); - gmp_rrandomb (PTR(x), rstate, nbits); + xp = MPZ_REALLOC (x, nl); + gmp_rrandomb (xp, rstate, nbits); } SIZ(x) = nl; |