diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-01-29 13:45:57 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-01-29 13:45:57 +0000 |
commit | e6559be7a708e66ac9ec633cd9cc0e4d07b2105b (patch) | |
tree | b3bc396e5e1c3a9672c788c8f9742347c565157f /tests/tnrandom.c | |
parent | e32c09fe27c46519c27672c841764b72c9615b20 (diff) | |
download | mpfr-e6559be7a708e66ac9ec633cd9cc0e4d07b2105b.tar.gz |
Cleanup of memory allocation in the tests:
* only tests_allocate, tests_reallocate and tests_free should be used
(now exported instead of mpfr_default_allocate, etc.);
* this is now mentioned in doc/README.dev;
* added checks to tools/mpfrlint (heuristics as usual).
Note: This follows the discussion at
https://sympa.inria.fr/sympa/arc/mpfr/2015-12/msg00055.html
and should solve these problems under MS Windows (mingw32), though this
cleanup is more general than an attempt to fix a Windows issue.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9891 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tnrandom.c')
-rw-r--r-- | tests/tnrandom.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/tnrandom.c b/tests/tnrandom.c index 707bf13d2..133ab20eb 100644 --- a/tests/tnrandom.c +++ b/tests/tnrandom.c @@ -49,12 +49,7 @@ test_nrandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, mpfr_t av, va, tmp; int i, inexact; - t = (mpfr_t *) malloc (nbtests * sizeof (mpfr_t)); - if (t == NULL) - { - fprintf (stderr, "tnrandom: can't allocate memory in test_nrandom\n"); - exit (1); - } + t = (mpfr_t *) tests_allocate (nbtests * sizeof (mpfr_t)); for (i = 0; i < nbtests; ++i) mpfr_init2 (t[i], prec); @@ -99,7 +94,7 @@ test_nrandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd, for (i = 0; i < nbtests; ++i) mpfr_clear (t[i]); - free (t); + tests_free (t, nbtests * sizeof (mpfr_t)); return; } |