]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(mergefps): Do not allocate at least sort_size bytes for each merge buffer.
authorJim Meyering <jim@meyering.net>
Sun, 26 Aug 2001 06:51:10 +0000 (06:51 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 26 Aug 2001 06:51:10 +0000 (06:51 +0000)
Instead, allocate at least sort_size bytes total.

src/sort.c

index 1f59a9b7358c48db89e323f724385418f27a5fee..17c42633ff44c3028eef80100b92b4494bce25ad 100644 (file)
@@ -1642,7 +1642,7 @@ mergefps (char **files, register int nfiles,
     {
       fps[i] = xfopen (files[i], "r");
       initbuf (&buffer[i], sizeof (struct line),
-              MAX (merge_buffer_size, sort_size));
+              MAX (merge_buffer_size, sort_size / nfiles));
       /* If a file is empty, eliminate it from future consideration. */
       while (i < nfiles && !fillbuf (&buffer[i], fps[i], files[i]))
        {