~michel-slm/coreutils

c4c5ed8f4e9cd55a12966d4f520e3a13101637d9 — Paul Eggert 8 months ago b09dc63
split: do not shrink hold buffer

* src/split.c (line_bytes_split): Do not shrink hold buffer.
If it’s large for this batch it’s likely to be large for the next
batch, and for ‘split’ it’s not worth the complexity/CPU hassle to
shrink it.  Do not assume hold_size can be bufsize.
1 files changed, 0 insertions(+), 3 deletions(-)

M src/split.c
M src/split.c => src/split.c +0 -3
@@ 809,10 809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
            {
              cwrite (n_out == 0, hold, n_hold);
              n_out += n_hold;
              if (n_hold > bufsize)
                hold = xirealloc (hold, bufsize);
              n_hold = 0;
              hold_size = bufsize;
            }

          /* Output to eol if present.  */