factor: improve gmp-related buffering
commitd598ef7a6cb37735f23dbcb95281d88eefdfab55
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 Sep 2024 03:01:58 +0000 (26 20:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 28 Sep 2024 00:42:59 +0000 (27 17:42 -0700)
tree549f3e94ea636e23fbb0d46fcda3a56ad05f64e4
parent666e226994bae539b10ce0859d07cad76edff28f
factor: improve gmp-related buffering

Previously, the code used stdio buffers for gmp numbers,
and did its own buffering for smaller numbers.  This meant
for more flushing than was needed.  The code now uses its
own buffering for all standard output, which makes for
less flushing and fewer writes.
* src/factor.c (lbuf_half_flush): New function, taken from the
body of lbuf_putnl.
(lbuf_putnl): Use it.
(lbuf_putmpz): New function, to output an mpz without using stdio.
(print_factors): Output via functions instead of via stdio.
src/factor.c