summaryrefslogtreecommitdiff
path: root/libguile/numbers.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2022-01-04 11:20:22 +0100
committerAndy Wingo <wingo@pobox.com>2022-01-13 09:37:16 +0100
commit24ce3cedfc286c3cc793d41ed557df8c449363e9 (patch)
tree9360c8ea684f0352f868ce92fca568b064922cee /libguile/numbers.c
parentfc36cd610dc1822957afc9e441d81fc8b33d7e56 (diff)
downloadguile-24ce3cedfc286c3cc793d41ed557df8c449363e9.tar.gz
Simplify scm_bigprint
* libguile/numbers.c (scm_bigprint): Just convert the number to a string and write that. Adds a copy but if we optimize scm_integer_to_string_z then that will be fixed.
Diffstat (limited to 'libguile/numbers.c')
-rw-r--r--libguile/numbers.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 1b6d29efa..51e5ee19a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -3820,13 +3820,8 @@ scm_i_print_fraction (SCM sexp, SCM port, scm_print_state *pstate SCM_UNUSED)
int
scm_bigprint (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
{
- char *str = mpz_get_str (NULL, 10, SCM_I_BIG_MPZ (exp));
- size_t len = strlen (str);
- void (*freefunc) (void *, size_t);
- mp_get_memory_functions (NULL, NULL, &freefunc);
- scm_remember_upto_here_1 (exp);
- scm_lfwrite (str, len, port);
- freefunc (str, len + 1);
+ SCM str = scm_integer_to_string_z (scm_bignum (exp), 10);
+ scm_c_put_string (port, str, 0, scm_c_string_length (str));
return !0;
}
/*** END nums->strs ***/