minux <minux...@gmail.com> writes: > patch updated. I actually had this question while making changes. But > I took advantage of the naming convention to use gmp_xfree for the > two-parameter version so that I do not have to fix all use of > one-parameter gmp_free in one pass. And then for consistency, I also > renamed realloc to xrealloc.
Committed at last, with minor changes (see below). > --- a/mini-gmp/tests/t-mpq_str.c Mon Mar 09 17:01:17 2020 +0100 > +++ b/mini-gmp/tests/t-mpq_str.c Thu Mar 12 15:50:15 2020 -0400 > @@ -1,6 +1,6 @@ > /* > > -Copyright 2012-2014, 2016, 2018 Free Software Foundation, Inc. > +Copyright 2012-2014, 2016, 2018, 2020 Free Software Foundation, Inc. > > This file is part of the GNU MP Library test suite. > > @@ -144,7 +144,7 @@ > char *ap; > char *bp; > char *rp; > - size_t rn, arn; > + size_t rn; > > mpq_t a, b; > > @@ -173,7 +173,6 @@ > } > > rn = strlen (rp); > - arn = rn - (rp[0] == '-'); > > bp = mpq_get_str (NULL, (i&1 || base > 36) ? base: -base, a); > if (strcmp (bp, rp)) > @@ -244,7 +243,17 @@ > > free (ap); > free (rp); > - testfree (bp); > + testfree (bp, strlen(bp) + 1); > + } > + > + /* Check behaviour (undocumented, but conforming with GMP) when > + base is out of range. */ > + base = (i&1) ? 63: -37; > + if (mpq_get_str (bp, base, a)) > + { > + fprintf (stderr, "mpz_get_str did not fail, as expected:\n"); > + fprintf (stderr, " base = %d\n", base); > + abort (); Dropped this test, since it seems unrelated. > --- a/mini-gmp/tests/testutils.c Mon Mar 09 17:01:17 2020 +0100 > +++ b/mini-gmp/tests/testutils.c Thu Mar 12 15:50:15 2020 -0400 > @@ -84,31 +84,44 @@ > static void * > tu_realloc (void *p, size_t old_size, size_t new_size) > { > - size_t *block = block_check (p); > - block = (size_t *) realloc (block, sizeof(size_t) + new_size + > sizeof(block_end)); > + size_t *old_block = block_check (p), *block; Declare block on a line of its own, size_t *block; Thanks! /Niels Möller -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel