summaryrefslogtreecommitdiff
path: root/out_str.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>1999-06-25 16:20:11 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>1999-06-25 16:20:11 +0000
commit2b63ff48fd2df719e33ae4d69a0a8f0266d35b4f (patch)
tree74515b1ba5888eb16cf6ffb25714c85a3ab5a581 /out_str.c
parentca57663950e80b89d5bd4ec240465dc9c7865220 (diff)
downloadmpfr-2b63ff48fd2df719e33ae4d69a0a8f0266d35b4f.tar.gz
use GMP allocate/free functions instead of malloc/free
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@201 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'out_str.c')
-rw-r--r--out_str.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/out_str.c b/out_str.c
index 1b4d6ebd9..3e492b1b0 100644
--- a/out_str.c
+++ b/out_str.c
@@ -7,12 +7,13 @@
size_t mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
unsigned char rnd_mode)
{
- char *s; size_t l; mp_exp_t e;
+ char *s,*s0; size_t l; mp_exp_t e;
if (FLAG_NAN(op)) { fprintf(stream, "NaN"); return 3; }
if (!NOTZERO(op)) { fprintf(stream, "0"); return 1; }
s = mpfr_get_str(NULL, &e, base, n_digits, op, rnd_mode);
+ s0 = s;
/* for op=3.1416 we have s = "31416" and e = 1 */
l = strlen(s)+1;
@@ -28,6 +29,6 @@ size_t mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
fprintf(stream, "%s", s);
}
- free(s);
+ (*_mp_free_func)(s0, l);
return l;
}