diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-07-23 23:07:13 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-07-23 23:07:13 +0200 |
commit | e1a291136b4928a8765c39719e212e84df402b56 (patch) | |
tree | 34d76cded848f69777be4224f57469badf0d0242 /mpq/get_str.c | |
parent | e7491ad8ca29764e033b3030ed09e4d30de39bc0 (diff) | |
download | gmp-e1a291136b4928a8765c39719e212e84df402b56.tar.gz |
* gmp-impl.h (__GMP_REALLOCATE_FUNC_MAYBE): New macro.
* mpz/get_str.c, mpq/get_str.c, mpf/get_str.c: Use it.
Diffstat (limited to 'mpq/get_str.c')
-rw-r--r-- | mpq/get_str.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mpq/get_str.c b/mpq/get_str.c index e57ad0de2..38a836605 100644 --- a/mpq/get_str.c +++ b/mpq/get_str.c @@ -1,4 +1,4 @@ -/* mpn_get_str -- mpq to string conversion. +/* mpq_get_str -- mpq to string conversion. Copyright 2001 Free Software Foundation, Inc. @@ -17,8 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. -*/ +MA 02111-1307, USA. */ #include <stdio.h> #include <string.h> @@ -61,8 +60,8 @@ mpq_get_str (char *str, int base, mpq_srcptr q) mpz_sizeinbase (mpq_numref(q), ABS(base)) + mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3); - if (str_alloc != 0 && str_alloc != len+1) - str = (char *) (*__gmp_reallocate_func) (str, str_alloc, len+1); - + if (str_alloc != 0) + __GMP_REALLOCATE_FUNC_MAYBE (str, str_alloc, len+1); + return str; } |