[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: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 6 Mar 2012 12:11:29 +0000 (GMT)

Hi Stefan.

Please edit the log message for this rev.

(I assume you'll revisit this soon, as my original comment still stands.  Sorry if it was confusing.  What I meant, basically, is that the function doesn't return what the doc string says it will return, AFAICT.  Quite likely it's the doc string that's wrong.)

- Julian

----- Original Message -----
> From: Stefan Fuhrmann <stefanfuhrmann_at_alice-dsl.de>
> To:
> Cc: dev_at_subversion.apache.org
> Sent: Sunday, 4 March 2012, 23:48
> Subject: Re: svn commit: r1296596 - /subversion/trunk/subversion/libsvn_delta/xdelta.c
>
> 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-06 13:12:05 CET

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