]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
split: do not shrink hold buffer
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 16 Jan 2024 21:48:32 +0000 (13:48 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 17 Jan 2024 20:19:14 +0000 (12:19 -0800)
* 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.

src/split.c

index 64020c859fa66adea4447c8a34f4155032972274..037960a5940b54ab410bcb8528b1c4ec35c5c3a8 100644 (file)
@@ -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.  */