summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authorTorbjorn Granlund <torbjorng@google.com>2015-09-29 21:24:58 +0200
committerTorbjorn Granlund <torbjorng@google.com>2015-09-29 21:24:58 +0200
commit25ff0b07e50cae0ff51b9e4fa96d4a2e70e3d910 (patch)
tree073f3464080d68a1c6ef967462d50f746c2bf3fd /mpf
parent99daa66cdd004e0390ba631a4c3de736fbfd18a9 (diff)
downloadgmp-25ff0b07e50cae0ff51b9e4fa96d4a2e70e3d910.tar.gz
Streamline, use macros.
Diffstat (limited to 'mpf')
-rw-r--r--mpf/clear.c4
-rw-r--r--mpf/clears.c9
-rw-r--r--mpf/inits.c7
3 files changed, 11 insertions, 9 deletions
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 <stdarg.h>
-#include <stdio.h> /* 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 <stdarg.h>
-#include <stdio.h> /* 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);
}