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

Re: svn commit: r1140388 - /subversion/trunk/subversion/libsvn_diff/diff_file.c

From: Hyrum K Wright <hyrum_at_hyrumwright.org>
Date: Mon, 27 Jun 2011 20:57:05 -0500

On Mon, Jun 27, 2011 at 7:25 PM, <jcorvel_at_apache.org> wrote:
> Author: jcorvel
> Date: Tue Jun 28 00:25:57 2011
> New Revision: 1140388
>
> URL: http://svn.apache.org/viewvc?rev=1140388&view=rev
> Log:
> Fix a spurious failure of diff-diff3-test 2: '2-way unified diff and trivial
> merge', reported by danielsh.
>
> * subversion/libsvn_diff/diff_file.c
>  (find_identical_suffix): Make sure variables had_cr and had_nl are always
>   initialized.
>
> Patch by: philip
> Reported by: danielsh
>
> Modified:
>    subversion/trunk/subversion/libsvn_diff/diff_file.c
>
> Modified: subversion/trunk/subversion/libsvn_diff/diff_file.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_file.c?rev=1140388&r1=1140387&r2=1140388&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_diff/diff_file.c (original)
> +++ subversion/trunk/subversion/libsvn_diff/diff_file.c Tue Jun 28 00:25:57 2011
> @@ -530,7 +530,7 @@ find_identical_suffix(apr_off_t *suffix_
>   int suffix_lines_to_keep = SUFFIX_LINES_TO_KEEP;
>   svn_boolean_t is_match, reached_prefix;
>   apr_off_t lines = 0;
> -  svn_boolean_t had_cr, had_nl;
> +  svn_boolean_t had_cr, had_nl = FALSE;

Contrary to your log message, this only ensures that had_nl is
initialized: the initialization statement does not affect had_cr. For
that you would need a second initialization statement for had_cr.

(This is one reason why many of us prefer one-variable-per-line
declaration style, rather than multiple-variables-per-line, as above.)

-Hyrum

>   apr_size_t i;
>
>   /* Initialize file_for_suffix[].
>
>
>
Received on 2011-06-28 03:57:42 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.