Author: artagnon
Date: Wed Sep 29 14:05:17 2010
New Revision: 1002637
URL: http://svn.apache.org/viewvc?rev=1002637&view=rev
Log:
svnrdump: dump_editor: Remove the cruft surrounding handler_baton and
don't use a separate pool for applying the textdelta.
* subversion/svnrdump/dump_editor.h
(handler_baton): Remove everything except the window_handler and the
corresponding baton. Everything else is unnecessary.
* subversion/svnrdump/dump_editor.c
(apply_textdelta): Remove the applier-specific pool and use the
revision-specific pool and scratch pool instead. Track the changes
in the handler_baton structrue and make appropriate local
variables. Also, don't copy delta_abspath twice- just write it once.
Modified:
subversion/trunk/subversion/svnrdump/dump_editor.c
subversion/trunk/subversion/svnrdump/dump_editor.h
Modified: subversion/trunk/subversion/svnrdump/dump_editor.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.c?rev=1002637&r1=1002636&r2=1002637&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Wed Sep 29 14:05:17 2010
@@ -61,7 +61,7 @@ struct dump_edit_baton {
svn_stringbuf_t *propstring;
/* Temporary file to write delta to along with its checksum. */
- char *delta_abspath;
+ const char *delta_abspath;
/* The checksum of the file the delta is being applied to */
const char *base_checksum;
@@ -680,7 +680,6 @@ static svn_error_t *
window_handler(svn_txdelta_window_t *window, void *baton)
{
struct handler_baton *hb = baton;
- struct dump_edit_baton *eb = hb->eb;
static svn_error_t *err;
err = hb->apply_handler(window, hb->apply_baton);
@@ -690,11 +689,6 @@ window_handler(svn_txdelta_window_t *win
if (err)
SVN_ERR(err);
- /* Write information about the filepath to hb->eb */
- eb->delta_abspath = apr_pstrdup(eb->pool, hb->delta_abspath);
-
- /* Cleanup */
- svn_pool_destroy(hb->pool);
return SVN_NO_ERROR;
}
@@ -707,21 +701,21 @@ apply_textdelta(void *file_baton, const
struct dump_edit_baton *eb = file_baton;
/* Custom handler_baton allocated in a separate pool */
- apr_pool_t *handler_pool = svn_pool_create(pool);
- struct handler_baton *hb = apr_pcalloc(handler_pool, sizeof(*hb));
- hb->pool = handler_pool;
- hb->eb = eb;
+ struct handler_baton *hb;
+ svn_stream_t *delta_filestream;
+
+ hb = apr_pcalloc(eb->pool, sizeof(*hb));
LDR_DBG(("apply_textdelta %p\n", file_baton));
/* Use a temporary file to measure the text-content-length */
- SVN_ERR(svn_stream_open_unique(&(hb->delta_filestream), &hb->delta_abspath,
- NULL, svn_io_file_del_none, hb->pool,
- hb->pool));
+ SVN_ERR(svn_stream_open_unique(&delta_filestream, &(eb->delta_abspath),
+ NULL, svn_io_file_del_none, eb->pool,
+ pool));
/* Prepare to write the delta to the temporary file. */
svn_txdelta_to_svndiff2(&(hb->apply_handler), &(hb->apply_baton),
- hb->delta_filestream, 0, hb->pool);
+ delta_filestream, 0, pool);
eb->dump_text = TRUE;
eb->base_checksum = apr_pstrdup(eb->pool, base_checksum);
Modified: subversion/trunk/subversion/svnrdump/dump_editor.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.h?rev=1002637&r1=1002636&r2=1002637&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.h (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.h Wed Sep 29 14:05:17 2010
@@ -64,17 +64,6 @@ struct handler_baton
{
svn_txdelta_window_handler_t apply_handler;
void *apply_baton;
-
- /* Pool used for temporary allocations during delta application in
- window_handler() */
- apr_pool_t *pool;
-
- /* Information about the path of the temporary file used */
- const char *delta_abspath;
- svn_stream_t *delta_filestream;
-
- /* Global edit baton */
- struct dump_edit_baton *eb;
};
/**