Re: cvs: pecl /xdiff CREDITS config.m4 php_xdiff.h xdiff.c xdiff.php

From: Date: Thu, 25 Dec 2003 11:14:42 +0000
Subject: Re: cvs: pecl /xdiff CREDITS config.m4 php_xdiff.h xdiff.c xdiff.php
References: 1 2 3 4 5  Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-623@lists.php.net to get a copy of this message
At 12:05 PM 12/25/2003 +0100, Derick Rethans wrote:
But which PHP function can I use for this then? Ah, xdiff_patch() of course. I do see another 'problem' though and that is that the functions do not make use of any of PHP's stream functions which would really make a nice addition. Another point (heh, I keep on bitching ;-) is that there are now two functions to patch (_patch and _bpatch). Wouldn't it be possible to merge those two into one function? Perhaps the proto's could be like this: string xdiff_compare(mixed file1, mixed file2); string xdiff_patch(mixed file1, mixed file2); string xdiff_merge3(mixed file1, mixed file2, mixed file3); where the mixed points to either a stream resource (returned from fopen() or a string). You can also just use strings so that you can use the functions like this (this would in my opinion the most powerful and flexible way): <?php $file1 = file_get_contents("input1.txt"); $file2 = file_get_contents("input2.txt"); file_put_contents('result.txt', xdiff_patch($file1, $file2)); ?> I admit it's a bit more code to write... You can also of course add this additional function: xdiff_patch_file('result.txt', 'input1.txt', 'input2.txt'); (I'm only shooting comments because I'm interested in this stuff :)
If he supports streams, isn't using files as parameters good enough? I don't really see anyone manually building diffs. Then again, I do see your point. I'm indifferent although we should give a way to easily support the general 99% case of using files. Is it worth having two sets of functions, for strings and for files? I think I've raised more questions than answers because I'm not sure myself. Andi

« previous php.pecl.cvs (#623) next »