summaryrefslogtreecommitdiff
path: root/mpf/out_str.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2005-10-31 22:34:12 +0100
committertege <tege@gmplib.org>2005-10-31 22:34:12 +0100
commit9b11c37b691bf5279da39b5932943cdf7f53aa1a (patch)
treef9dbfb30deb6309fb58799b145b8150afecdf8a8 /mpf/out_str.c
parent5f8e47b7842d449902c386c85c73a7443d6ff1ea (diff)
downloadgmp-9b11c37b691bf5279da39b5932943cdf7f53aa1a.tar.gz
List some allocation improvement ideas.
Diffstat (limited to 'mpf/out_str.c')
-rw-r--r--mpf/out_str.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mpf/out_str.c b/mpf/out_str.c
index 225985837..4da31d43e 100644
--- a/mpf/out_str.c
+++ b/mpf/out_str.c
@@ -58,6 +58,12 @@ mpf_out_str (FILE *stream, int base, size_t n_digits, mpf_srcptr op)
if (stream == 0)
stream = stdout;
+ /* Consider these changes:
+ * Don't allocate memory here for huge n_digits; pass NULL to mpf_get_str.
+ * Make mpf_get_str allocate extra space when passed NULL, to avoid
+ allocating two huge string buffers.
+ * Implement more/other allocation reductions tricks. */
+
str = (char *) TMP_ALLOC (n_digits + 2); /* extra for minus sign and \0 */
mpf_get_str (str, &exp, base, n_digits, op);