From 25ff0b07e50cae0ff51b9e4fa96d4a2e70e3d910 Mon Sep 17 00:00:00 2001 From: Torbjorn Granlund Date: Tue, 29 Sep 2015 21:24:58 +0200 Subject: Streamline, use macros. --- mpf/clear.c | 4 ++-- mpf/clears.c | 9 +++++---- mpf/inits.c | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'mpf') diff --git a/mpf/clear.c b/mpf/clear.c index 2df0de579..9ff2dd336 100644 --- a/mpf/clear.c +++ b/mpf/clear.c @@ -33,7 +33,7 @@ see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" void -mpf_clear (mpf_ptr m) +mpf_clear (mpf_ptr x) { - (*__gmp_free_func) (m->_mp_d, (size_t) (m->_mp_prec + 1) * GMP_LIMB_BYTES); + __GMP_FREE_FUNC_LIMBS (PTR(x), PREC(x) + 1); } diff --git a/mpf/clears.c b/mpf/clears.c index addbe8faf..17eca8208 100644 --- a/mpf/clears.c +++ b/mpf/clears.c @@ -1,6 +1,6 @@ /* mpf_clears() -- Clear multiple mpf_t variables. -Copyright 2009, 2014 Free Software Foundation, Inc. +Copyright 2009, 2014, 2015 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #include -#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" @@ -40,10 +39,12 @@ mpf_clears (mpf_ptr x, ...) va_start (ap, x); - while (x != NULL) + do { - (*__gmp_free_func) (x->_mp_d, (size_t) (x->_mp_prec + 1) * GMP_LIMB_BYTES); + __GMP_FREE_FUNC_LIMBS (PTR(x), PREC(x) + 1); x = va_arg (ap, mpf_ptr); } + while (x != NULL); + va_end (ap); } diff --git a/mpf/inits.c b/mpf/inits.c index fb14c6b0f..ddcf1141a 100644 --- a/mpf/inits.c +++ b/mpf/inits.c @@ -1,6 +1,6 @@ /* mpf_inits() -- Initialize multiple mpf_t variables and set them to 0. -Copyright 2009 Free Software Foundation, Inc. +Copyright 2009, 2015 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -29,7 +29,6 @@ GNU Lesser General Public License along with the GNU MP Library. If not, see https://www.gnu.org/licenses/. */ #include -#include /* for NULL */ #include "gmp.h" #include "gmp-impl.h" @@ -40,10 +39,12 @@ mpf_inits (mpf_ptr x, ...) va_start (ap, x); - while (x != NULL) + do { mpf_init (x); x = va_arg (ap, mpf_ptr); } + while (x != NULL); + va_end (ap); } -- cgit v1.2.1