stef...@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.

>  }
>  
>  
> 
> 

Reply via email to