You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/02/09 23:55:47 UTC

svn commit: r1242586 - /subversion/trunk/subversion/svnrdump/dump_editor.c

Author: hwright
Date: Thu Feb  9 22:55:46 2012
New Revision: 1242586

URL: http://svn.apache.org/viewvc?rev=1242586&view=rev
Log:
Be more explicit about the members of a baton that a function requires by
passing them individually, rather than just the baton.

* subversion/svnrdump/dump_editor.c
  (do_dump_props): Remove baton param, and use specific props instead.
  (delete_entry, add_directory, open_directory, close_directory, add_file,
   open_file, close_file): Update callers.

Modified:
    subversion/trunk/subversion/svnrdump/dump_editor.c

Modified: subversion/trunk/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.c?rev=1242586&r1=1242585&r2=1242586&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Thu Feb  9 22:55:46 2012
@@ -214,10 +214,14 @@ get_props_content(svn_stringbuf_t **head
  * Unless DUMP_DATA_TOO is set, only property headers are dumped.
  */
 static svn_error_t *
-do_dump_props(struct dump_edit_baton *eb,
+do_dump_props(svn_stringbuf_t **propstring,
+              svn_stream_t *stream,
+              apr_hash_t *props,
+              apr_hash_t *deleted_props,
               svn_boolean_t *trigger_var,
               svn_boolean_t dump_data_too,
-              apr_pool_t *pool)
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool)
 {
   svn_stringbuf_t *header;
   svn_stringbuf_t *content;
@@ -226,33 +230,33 @@ do_dump_props(struct dump_edit_baton *eb
   if (trigger_var && !*trigger_var)
     return SVN_NO_ERROR;
 
-  SVN_ERR(get_props_content(&header, &content, eb->props, eb->deleted_props,
-                            pool, pool));
+  SVN_ERR(get_props_content(&header, &content, props, deleted_props,
+                            result_pool, scratch_pool));
 
   /* This is a wacky side-effect of this function. */
-  eb->propstring = svn_stringbuf_dup(content, eb->pool);
+  *propstring = content;
 
   len = header->len;
-  SVN_ERR(svn_stream_write(eb->stream, header->data, &len));
+  SVN_ERR(svn_stream_write(stream, header->data, &len));
 
   if (dump_data_too)
     {
       /* Content-length: 14 */
-      SVN_ERR(svn_stream_printf(eb->stream, pool,
+      SVN_ERR(svn_stream_printf(stream, scratch_pool,
                                 SVN_REPOS_DUMPFILE_CONTENT_LENGTH
                                 ": %" APR_SIZE_T_FMT "\n\n",
                                 content->len));
 
       len = content->len;
-      SVN_ERR(svn_stream_write(eb->stream, content->data, &len));
+      SVN_ERR(svn_stream_write(stream, content->data, &len));
 
       /* No text is going to be dumped. Write a couple of newlines and
          wait for the next node/ revision. */
-      SVN_ERR(svn_stream_printf(eb->stream, pool, "\n\n"));
+      SVN_ERR(svn_stream_printf(stream, scratch_pool, "\n\n"));
 
       /* Cleanup so that data is never dumped twice. */
-      SVN_ERR(svn_hash__clear(eb->props, eb->pool));
-      SVN_ERR(svn_hash__clear(eb->deleted_props, eb->pool));
+      SVN_ERR(svn_hash__clear(props, scratch_pool));
+      SVN_ERR(svn_hash__clear(deleted_props, scratch_pool));
       if (trigger_var)
         *trigger_var = FALSE;
     }
@@ -441,7 +445,9 @@ delete_entry(const char *path,
   LDR_DBG(("delete_entry %s\n", path));
 
   /* Some pending properties to dump? */
-  SVN_ERR(do_dump_props(pb->eb, &(pb->eb->dump_props), TRUE, pool));
+  SVN_ERR(do_dump_props(&pb->eb->propstring, pb->eb->stream,
+                        pb->eb->props, pb->eb->deleted_props,
+                        &(pb->eb->dump_props), TRUE, pool, pool));
 
   /* Some pending newlines to dump? */
   SVN_ERR(do_dump_newlines(pb->eb, &(pb->eb->dump_newlines), pool));
@@ -473,7 +479,9 @@ add_directory(const char *path,
                           pb, TRUE, pb->eb->pool);
 
   /* Some pending properties to dump? */
-  SVN_ERR(do_dump_props(pb->eb, &(pb->eb->dump_props), TRUE, pool));
+  SVN_ERR(do_dump_props(&pb->eb->propstring, pb->eb->stream,
+                        pb->eb->props, pb->eb->deleted_props,
+                        &(pb->eb->dump_props), TRUE, pool, pool));
 
   /* Some pending newlines to dump? */
   SVN_ERR(do_dump_newlines(pb->eb, &(pb->eb->dump_newlines), pool));
@@ -518,7 +526,9 @@ open_directory(const char *path,
   LDR_DBG(("open_directory %s\n", path));
 
   /* Some pending properties to dump? */
-  SVN_ERR(do_dump_props(pb->eb, &(pb->eb->dump_props), TRUE, pool));
+  SVN_ERR(do_dump_props(&pb->eb->propstring, pb->eb->stream,
+                        pb->eb->props, pb->eb->deleted_props,
+                        &(pb->eb->dump_props), TRUE, pool, pool));
 
   /* Some pending newlines to dump? */
   SVN_ERR(do_dump_newlines(pb->eb, &(pb->eb->dump_newlines), pool));
@@ -550,7 +560,9 @@ close_directory(void *dir_baton,
   LDR_DBG(("close_directory %p\n", dir_baton));
 
   /* Some pending properties to dump? */
-  SVN_ERR(do_dump_props(eb, &(eb->dump_props), TRUE, pool));
+  SVN_ERR(do_dump_props(&eb->propstring, eb->stream,
+                        eb->props, eb->deleted_props,
+                        &(eb->dump_props), TRUE, pool, pool));
 
   /* Some pending newlines to dump? */
   SVN_ERR(do_dump_newlines(eb, &(eb->dump_newlines), pool));
@@ -584,7 +596,9 @@ add_file(const char *path,
   LDR_DBG(("add_file %s\n", path));
 
   /* Some pending properties to dump? */
-  SVN_ERR(do_dump_props(pb->eb, &(pb->eb->dump_props), TRUE, pool));
+  SVN_ERR(do_dump_props(&pb->eb->propstring, pb->eb->stream,
+                        pb->eb->props, pb->eb->deleted_props,
+                        &(pb->eb->dump_props), TRUE, pool, pool));
 
   /* Some pending newlines to dump? */
   SVN_ERR(do_dump_newlines(pb->eb, &(pb->eb->dump_newlines), pool));
@@ -629,7 +643,9 @@ open_file(const char *path,
   LDR_DBG(("open_file %s\n", path));
 
   /* Some pending properties to dump? */
-  SVN_ERR(do_dump_props(pb->eb, &(pb->eb->dump_props), TRUE, pool));
+  SVN_ERR(do_dump_props(&pb->eb->propstring, pb->eb->stream,
+                        pb->eb->props, pb->eb->deleted_props,
+                        &(pb->eb->dump_props), TRUE, pool, pool));
 
   /* Some pending newlines to dump? */
   SVN_ERR(do_dump_newlines(pb->eb, &(pb->eb->dump_newlines), pool));
@@ -789,7 +805,9 @@ close_file(void *file_baton,
 
   /* Some pending properties to dump? Dump just the headers- dump the
      props only after dumping the text headers too (if present) */
-  SVN_ERR(do_dump_props(eb, &(eb->dump_props), FALSE, pool));
+  SVN_ERR(do_dump_props(&eb->propstring, eb->stream,
+                        eb->props, eb->deleted_props,
+                        &(eb->dump_props), FALSE, pool, pool));
 
   /* Dump the text headers */
   if (eb->dump_text)