Author: julianfoad
Date: Mon Nov 21 13:38:13 2011
New Revision: 1204489

URL: http://svn.apache.org/viewvc?rev=1204489&view=rev
Log:
Move more variables to a smaller scope and fix uninitialized output
parameters in callback functions. The variables previously had
initializers which were only necessary because the callbacks didn't
always initialize all their outputs as they should. This change might be
expected to cause a behaviour change, since the initialization was
previously happening only once before the first iteration of the loop.
I have checked fairly thoroughly and it seems in the cases where
outputs weren't initialized they weren't tested or the loop terminated
or there was some other compensating effect.

* subversion/libsvn_client/merge.c:
  (merged_file_changed, merged_file_added, merged_file_deleted):
    Initialize the 'tree_conflicted' output at the beginning, as not all code
    paths set it before returning.
  (do_file_merge): Move variables to a smaller scope; remove initializers.

Modified:
    subversion/trunk/subversion/libsvn_client/merge.c

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1204489&r1=1204488&r2=1204489&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Nov 21 13:38:13 2011
@@ -1462,6 +1462,9 @@ merge_file_changed(svn_wc_notify_state_t
   SVN_ERR_ASSERT(!older_abspath || svn_dirent_is_absolute(older_abspath));
   SVN_ERR_ASSERT(!yours_abspath || svn_dirent_is_absolute(yours_abspath));
 
+  if (tree_conflicted)
+    *tree_conflicted = FALSE;
+
   /* Check for an obstructed or missing node on disk. */
   {
     svn_wc_notify_state_t obstr_state;
@@ -1692,6 +1695,9 @@ merge_file_added(svn_wc_notify_state_t *
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(mine_abspath));
 
+  if (tree_conflicted)
+    *tree_conflicted = FALSE;
+
   /* Easy out: We are only applying mergeinfo differences. */
   if (merge_b->record_only)
     {
@@ -2016,6 +2022,9 @@ merge_file_deleted(svn_wc_notify_state_t
                                              mine_relpath, scratch_pool);
   svn_node_kind_t kind;
 
+  if (tree_conflicted)
+    *tree_conflicted = FALSE;
+
   if (merge_b->dry_run)
     {
       const char *wcpath = apr_pstrdup(merge_b->pool, mine_abspath);
@@ -6726,9 +6735,6 @@ do_file_merge(svn_mergeinfo_catalog_t re
               apr_pool_t *scratch_pool)
 {
   apr_array_header_t *remaining_ranges;
-  svn_wc_notify_state_t prop_state = svn_wc_notify_state_unknown;
-  svn_wc_notify_state_t text_state = svn_wc_notify_state_unknown;
-  svn_boolean_t tree_conflicted = FALSE;
   svn_client_ctx_t *ctx = merge_b->ctx;
   const char *mergeinfo_path;
   svn_merge_range_t range;
@@ -6855,6 +6861,8 @@ do_file_merge(svn_mergeinfo_catalog_t re
           svn_string_t *pval;
           const char *mimetype1, *mimetype2;
           apr_array_header_t *propchanges;
+          svn_wc_notify_state_t prop_state, text_state;
+          svn_boolean_t tree_conflicted = TRUE;
 
           svn_pool_clear(iterpool);
 


Reply via email to