factor: improve fd buffering
commit2bd3db74d562058de3c50787a9b52b743e74fce8
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 26 Sep 2024 22:36:44 +0000 (26 15:36 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 28 Sep 2024 00:42:59 +0000 (27 17:42 -0700)
tree8ffc09036b7f751157a2f7bc27efa7d2898d5ec7
parent7c1149359a87bb159d7e96be4a38467855f167c5
factor: improve fd buffering

* src/factor.c (struct lbuf_, lbuf, lbuf_alloc): Remove.
All uses removed.
(FACTOR_PIPE_BUF): Now a constant instead of a macro.
Increase to PIPE_BUF if available.
(lbuf_buf, lbuffered): New static vars, replacing lbuf.
All uses changed.
(lbuf_flush): Avoid unlikely recursion on write failure.
(lbuf_putc): Now simply adds a byte to the buffer.
(lbuf_putnl): Do the work of the old lbuf_putc ('\n').
Use changed.  Use memrchr to find the newline.
(lbuf_putint): Widths are now int, not size_t.
NEWS
src/factor.c