split.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. From c4c5ed8f4e9cd55a12966d4f520e3a13101637d9 Mon Sep 17 00:00:00 2001
  2. From: Paul Eggert <eggert@cs.ucla.edu>
  3. Date: Tue, 16 Jan 2024 13:48:32 -0800
  4. Subject: [PATCH] split: do not shrink hold buffer
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. * src/split.c (line_bytes_split): Do not shrink hold buffer.
  9. If it’s large for this batch it’s likely to be large for the next
  10. batch, and for ‘split’ it’s not worth the complexity/CPU hassle to
  11. shrink it. Do not assume hold_size can be bufsize.
  12. ---
  13. src/split.c | 3 ---
  14. 1 file changed, 3 deletions(-)
  15. diff --git a/src/split.c b/src/split.c
  16. index 64020c859..037960a59 100644
  17. --- a/src/split.c
  18. +++ b/src/split.c
  19. @@ -809,10 +809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
  20. {
  21. cwrite (n_out == 0, hold, n_hold);
  22. n_out += n_hold;
  23. - if (n_hold > bufsize)
  24. - hold = xirealloc (hold, bufsize);
  25. n_hold = 0;
  26. - hold_size = bufsize;
  27. }
  28. /* Output to eol if present. */