[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1296596 - /subversion/trunk/subversion/libsvn_delta/xdelta.c

From: Stefan Fuhrmann <stefanfuhrmann_at_alice-dsl.de>
Date: Mon, 05 Mar 2012 00:48:25 +0100

On 04.03.2012 11:42, Daniel Shahaf wrote:
> stefan2_at_apache.org wrote on Sat, Mar 03, 2012 at 10:53:16 -0000:
>> Author: stefan2
>> Date: Sat Mar 3 10:53:16 2012
>> New Revision: 1296596
>>
>> URL: http://svn.apache.org/viewvc?rev=1296596&view=rev
>> Log:
>> * subversion/libsvn_delta/xdelta.c
>> (reverse_match_length): actually return MAX_LEN if MAX_LEN chars match.
>>
>> Found by: julianfoad
>>
>> Modified:
>> subversion/trunk/subversion/libsvn_delta/xdelta.c
>>
>> Modified: subversion/trunk/subversion/libsvn_delta/xdelta.c
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/xdelta.c?rev=1296596&r1=1296595&r2=1296596&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_delta/xdelta.c (original)
>> +++ subversion/trunk/subversion/libsvn_delta/xdelta.c Sat Mar 3 10:53:16 2012
>> @@ -260,11 +260,15 @@ reverse_match_length(const char *a, cons
>>
>> #endif
>>
>> + /* If we find a mismatch at -pos, pos-1 characters matched.
>> + */
>> while (++pos<= max_len)
>> if (a[0-pos] != b[0-pos])
>> - break;
>> + return pos - 1;
>>
>> - return pos-1;
>> + /* No mismatch found -> at least MAX_LEN machting chars.
>> + */
>> + return max_len;
> I may be blind, but isn't the code before this diff and after it
> equivalent?
>
> Both the old and new code return POS-1 when the if() statement is
> entered, and if the code falls off the end of the while() loop then
> necessarily POS=1+MAX_LEN, again meaning that the old and new code are
> equivalent.

You are right. It's been too early in the morning
for me and Julian's comment got me confused.
But at least, the code slightly clearer now.

-- Stefan^2.
Received on 2012-03-05 00:49:01 CET

This is an archived mail posted to the Subversion Dev mailing list.