You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/11/13 12:57:02 UTC

svn commit: r1408686 - /subversion/trunk/subversion/svnmucc/svnmucc.c

Author: rhuijben
Date: Tue Nov 13 11:57:01 2012
New Revision: 1408686

URL: http://svn.apache.org/viewvc?rev=1408686&view=rev
Log:
Apply some correctness and debug easing changes on svnmucc.

* subversion/svnmucc/svnmucc.c
  (change_props): Use typed variables.
  (drive): Use typed variables. Recurse into children of a directory that
    receives property changes. Always close opened directories.
    (Recursing and closing was missed for at least property changes)
  (execute): Avoid using an uninitialized struct. Don't lose errors when
    we can combine them.

Modified:
    subversion/trunk/subversion/svnmucc/svnmucc.c

Modified: subversion/trunk/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnmucc/svnmucc.c?rev=1408686&r1=1408685&r2=1408686&view=diff
==============================================================================
--- subversion/trunk/subversion/svnmucc/svnmucc.c (original)
+++ subversion/trunk/subversion/svnmucc/svnmucc.c Tue Nov 13 11:57:01 2012
@@ -203,15 +203,14 @@ change_props(const svn_delta_editor_t *e
       for (hi = apr_hash_first(pool, child->prop_mods);
            hi; hi = apr_hash_next(hi))
         {
-          const void *key;
-          void *val;
+          const char *propname = svn__apr_hash_index_key(hi);
+          const svn_string_t *val = svn__apr_hash_index_val(hi);
 
           svn_pool_clear(iterpool);
-          apr_hash_this(hi, &key, NULL, &val);
           if (child->kind == svn_node_dir)
-            SVN_ERR(editor->change_dir_prop(baton, key, val, iterpool));
+            SVN_ERR(editor->change_dir_prop(baton, propname, val, iterpool));
           else
-            SVN_ERR(editor->change_file_prop(baton, key, val, iterpool));
+            SVN_ERR(editor->change_file_prop(baton, propname, val, iterpool));
         }
     }
 
@@ -234,14 +233,11 @@ drive(struct operation *operation,
   for (hi = apr_hash_first(pool, operation->children);
        hi; hi = apr_hash_next(hi))
     {
-      const void *key;
-      void *val;
-      struct operation *child;
+      const char *key = svn__apr_hash_index_key(hi);
+      struct operation *child = svn__apr_hash_index_val(hi);
       void *file_baton = NULL;
 
       svn_pool_clear(subpool);
-      apr_hash_this(hi, &key, NULL, &val);
-      child = val;
 
       /* Deletes and replacements are simple -- delete something. */
       if (child->operation == OP_DELETE || child->operation == OP_REPLACE)
@@ -312,15 +308,12 @@ drive(struct operation *operation,
       /* If we opened, added, or replaced a directory, we need to
          recurse, apply outstanding propmods, and then close it. */
       if ((child->kind == svn_node_dir)
-          && (child->operation == OP_OPEN
-              || child->operation == OP_ADD
-              || child->operation == OP_REPLACE))
+          && child->operation != OP_DELETE)
         {
+          SVN_ERR(change_props(editor, child->baton, child, subpool));
+
           SVN_ERR(drive(child, head, editor, subpool));
-          if (child->kind == svn_node_dir)
-            {
-              SVN_ERR(change_props(editor, child->baton, child, subpool));
-            }
+
           SVN_ERR(editor->close_directory(child->baton, subpool));
         }
     }
@@ -792,8 +785,10 @@ execute(const apr_array_header_t *action
       head = base_revision;
     }
 
+  memset(&root, 0, sizeof(root));
   root.children = apr_hash_make(pool);
   root.operation = OP_OPEN;
+  root.kind = svn_node_dir; /* For setting properties */
   root.prop_mods = apr_hash_make(pool);
   root.prop_dels = apr_array_make(pool, 1, sizeof(const char *));
 
@@ -868,7 +863,8 @@ execute(const apr_array_header_t *action
     err = editor->close_edit(editor_baton, pool);
 
   if (err)
-    svn_error_clear(editor->abort_edit(editor_baton, pool));
+    err = svn_error_compose_create(err,
+                                   editor->abort_edit(editor_baton, pool));
 
   return err;
 }



Re: svn commit: r1408686 - /subversion/trunk/subversion/svnmucc/svnmucc.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
rhuijben@apache.org wrote on Tue, Nov 13, 2012 at 11:57:02 -0000:
> Author: rhuijben
> Date: Tue Nov 13 11:57:01 2012
> New Revision: 1408686
> 
> URL: http://svn.apache.org/viewvc?rev=1408686&view=rev
> Log:
> Apply some correctness and debug easing changes on svnmucc.
> 
> @@ -792,8 +785,10 @@ execute(const apr_array_header_t *action
>        head = base_revision;
>      }
>  
> +  memset(&root, 0, sizeof(root));
>    root.children = apr_hash_make(pool);
>    root.operation = OP_OPEN;
> +  root.kind = svn_node_dir; /* For setting properties */

I considered this, but it was already set this way, and svn_node_dir != 0, 
so I assumed it got intentionally set to svn_node_dir somewhere.

>    root.prop_mods = apr_hash_make(pool);
>    root.prop_dels = apr_array_make(pool, 1, sizeof(const char *));

Re: svn commit: r1408686 - /subversion/trunk/subversion/svnmucc/svnmucc.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
rhuijben@apache.org wrote on Tue, Nov 13, 2012 at 11:57:02 -0000:
> Author: rhuijben
> Date: Tue Nov 13 11:57:01 2012
> New Revision: 1408686
> 
> URL: http://svn.apache.org/viewvc?rev=1408686&view=rev
> Log:
> Apply some correctness and debug easing changes on svnmucc.
> 
> @@ -792,8 +785,10 @@ execute(const apr_array_header_t *action
>        head = base_revision;
>      }
>  
> +  memset(&root, 0, sizeof(root));
>    root.children = apr_hash_make(pool);
>    root.operation = OP_OPEN;
> +  root.kind = svn_node_dir; /* For setting properties */

I considered this, but it was already set this way, and svn_node_dir != 0, 
so I assumed it got intentionally set to svn_node_dir somewhere.

>    root.prop_mods = apr_hash_make(pool);
>    root.prop_dels = apr_array_make(pool, 1, sizeof(const char *));