Re: These new diffs are great, but...
On 7/7/06, Goswin von Brederlow <email@example.com> wrote:
What code do you need there? If the rred method keeps the full Index
file in memory during patching it can just be fed all the patches one
after another and only write out the final result at the
end. Combining the patches is a simple cat.
As far as I can see from the code, it reads the input file and the
patch with fgets() and writes the output file with fputs(). Since the
diffs in the file are in reverse order, it first reads one ed command
and recurses so it forms on the stack a set of the file offsets of all
the patches. As it unwinds it scans forward through the data file once
to apply the patches.
Not a terribly bad algorith as such, but it's got quite a bit of disk
overhead if the individual files are on disk. It would appear that the
algorithm would allow itself to stream output from one patch applier
to another, but it would seem to be easiest to simply combine the
diffs into one large diff. Techniques for combining diffs are not new,
I imagine someone just needs to code it...
Hope this helps,
Martijn van Oosterhout <firstname.lastname@example.org> http://svana.org/kleptog/