summaryrefslogtreecommitdiff
path: root/mpq
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 /mpq
parent99daa66cdd004e0390ba631a4c3de736fbfd18a9 (diff)
downloadgmp-25ff0b07e50cae0ff51b9e4fa96d4a2e70e3d910.tar.gz
Streamline, use macros.
Diffstat (limited to 'mpq')
-rw-r--r--mpq/clear.c10
-rw-r--r--mpq/clears.c13
-rw-r--r--mpq/inits.c7
3 files changed, 14 insertions, 16 deletions
diff --git a/mpq/clear.c b/mpq/clear.c
index 6de593f8b..9b08f239c 100644
--- a/mpq/clear.c
+++ b/mpq/clear.c
@@ -1,6 +1,6 @@
/* mpq_clear -- free the space occupied by an mpq_t.
-Copyright 1991, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2000, 2001, 2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -32,10 +32,8 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
void
-mpq_clear (mpq_t m)
+mpq_clear (mpq_t x)
{
- (*__gmp_free_func) (PTR(NUM(m)),
- (size_t) ALLOC(NUM(m)) * GMP_LIMB_BYTES);
- (*__gmp_free_func) (PTR(DEN(m)),
- (size_t) ALLOC(DEN(m)) * GMP_LIMB_BYTES);
+ __GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
+ __GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
}
diff --git a/mpq/clears.c b/mpq/clears.c
index f949fe36c..c5f6539a6 100644
--- a/mpq/clears.c
+++ b/mpq/clears.c
@@ -1,6 +1,6 @@
/* mpq_clears() -- Clear multiple mpq_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,13 +39,13 @@ mpq_clears (mpq_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
- (*__gmp_free_func) (PTR(NUM(x)),
- (size_t) ALLOC(NUM(x)) * GMP_LIMB_BYTES);
- (*__gmp_free_func) (PTR(DEN(x)),
- (size_t) ALLOC(DEN(x)) * GMP_LIMB_BYTES);
+ __GMP_FREE_FUNC_LIMBS (PTR(NUM(x)), ALLOC(NUM(x)));
+ __GMP_FREE_FUNC_LIMBS (PTR(DEN(x)), ALLOC(DEN(x)));
x = va_arg (ap, mpq_ptr);
}
+ while (x != NULL);
+
va_end (ap);
}
diff --git a/mpq/inits.c b/mpq/inits.c
index 97c41656f..084c71e00 100644
--- a/mpq/inits.c
+++ b/mpq/inits.c
@@ -1,6 +1,6 @@
/* mpq_inits() -- Initialize multiple mpq_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 @@ mpq_inits (mpq_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
mpq_init (x);
x = va_arg (ap, mpq_ptr);
}
+ while (x != NULL);
+
va_end (ap);
}