]> git.ipfire.org Git - thirdparty/coreutils.git/commit
join: improve memory management
authorBo Borgerson <gigabo@gmail.com>
Tue, 22 Apr 2008 20:19:58 +0000 (16:19 -0400)
committerJim Meyering <meyering@redhat.com>
Mon, 16 Jun 2008 22:52:30 +0000 (00:52 +0200)
commit94cecb5cf6922130f10a640614fb2e16945c5432
treec6d73d47158bdf19f13de11577bb5bf5602f4765
parent58db1bb942bd8f23b33d8f21423e7da330312133
join: improve memory management

* src/join.c (struct seq): Use a (struct line **) for `lines' rather than
one long (struct line *).  This allows individual lines to be swapped out
if necessary.
(reset_line): Get a line ready for new input.
(init_linep): Create a new line and assign it to the the pointer passed in.
(spareline[2]): Hold a spare line for each input file.
(free_spareline): Clean up.
(get_line): Take a (struct line **) instead of a (struct line *).  If the
line to be overwritten is the previous line for the current file then swap
it out for the spare.
(join): Accomodate new structure of SEQs and new parameters to get_line;
Don't free stale lines until the end -- they're re-usable now.
(dup_line): Remove function.
* NEWS: Mention the performance improvement.
NEWS
src/join.c