diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-06-01 08:19:24 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-06-01 08:19:24 +0200 |
commit | 7254eaa28b343bfc05de46c618f6617ec7de23aa (patch) | |
tree | 5ea5188cca613dd4b8a0c941b3be7be468aea4d6 /mpq/set.c | |
parent | d16b005b490eabeda823c3fb00fef9329a4cf649 (diff) | |
download | gmp-7254eaa28b343bfc05de46c618f6617ec7de23aa.tar.gz |
mpq: Use more macros and MPZ_REALLOC return value when possible.
Diffstat (limited to 'mpq/set.c')
-rw-r--r-- | mpq/set.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1,6 +1,6 @@ /* mpq_set(dest,src) -- Set DEST to SRC. -Copyright 1991, 1994, 1995, 2001 Free Software Foundation, Inc. +Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -21,19 +21,20 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpq_set (MP_RAT *dest, const MP_RAT *src) +mpq_set (mpq_ptr dest, mpq_srcptr src) { mp_size_t num_size, den_size; mp_size_t abs_num_size; + mp_ptr dp; num_size = SIZ(NUM(src)); abs_num_size = ABS (num_size); - MPZ_REALLOC (NUM(dest), abs_num_size); - MPN_COPY (PTR(NUM(dest)), PTR(NUM(src)), abs_num_size); + dp = MPZ_REALLOC (NUM(dest), abs_num_size); SIZ(NUM(dest)) = num_size; + MPN_COPY (dp, PTR(NUM(src)), abs_num_size); den_size = SIZ(DEN(src)); - MPZ_REALLOC (DEN(dest), den_size); - MPN_COPY (PTR(DEN(dest)), PTR(DEN(src)), den_size); + dp = MPZ_REALLOC (DEN(dest), den_size); SIZ(DEN(dest)) = den_size; + MPN_COPY (dp, PTR(DEN(src)), den_size); } |