summaryrefslogtreecommitdiff
path: root/mpz/inits.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpz/inits.c')
-rw-r--r--mpz/inits.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/mpz/inits.c b/mpz/inits.c
index 0488edaa4..7d13883e1 100644
--- a/mpz/inits.c
+++ b/mpz/inits.c
@@ -1,6 +1,6 @@
/* mpz_inits() -- Initialize multiple mpz_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,20 @@ mpz_inits (mpz_ptr x, ...)
va_start (ap, x);
- while (x != NULL)
+ do
{
- mpz_init (x);
+ ALLOC (x) = 1;
+ PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ SIZ (x) = 0;
+
+#ifdef __CHECKER__
+ /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
+ PTR (x) = 0;
+#endif
+
x = va_arg (ap, mpz_ptr);
}
+ while (x != NULL);
+
va_end (ap);
}