mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
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.
This commit is contained in:
parent
fc36cd610d
commit
24ce3cedfc
1 changed files with 2 additions and 7 deletions
|
@ -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 ***/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue