You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ar...@apache.org on 2010/09/29 09:44:48 UTC
svn commit: r1002502 - /subversion/trunk/subversion/svnrdump/dump_editor.c
Author: artagnon
Date: Wed Sep 29 07:44:48 2010
New Revision: 1002502
URL: http://svn.apache.org/viewvc?rev=1002502&view=rev
Log:
svnrdump: dump_editor: Followup r1002470 to avoid creating a toplevel
pool by changing the function that creates the per-revision pool.
* subversion/svnrdump/dump_editor.c
(open_root): Don't create the per-revision pool here. Simply clear
it after each iteration here.
(get_dump_editor): Create the per-revision pool `eb->pool` here and
make it a subpool of `pool` so that it's cleaned up when `pool` is
cleaned up.
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=1002502&r1=1002501&r2=1002502&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Wed Sep 29 07:44:48 2010
@@ -368,11 +368,8 @@ open_root(void *edit_baton,
{
struct dump_edit_baton *eb = edit_baton;
- /* Special toplevel per-revision pool */
- if (eb->pool)
- svn_pool_clear(eb->pool);
- else
- eb->pool = svn_pool_create(NULL);
+ /* Clear the per-revision pool after each revision */
+ svn_pool_clear(eb->pool);
eb->props = apr_hash_make(eb->pool);
eb->deleted_props = apr_hash_make(eb->pool);
@@ -852,6 +849,9 @@ get_dump_editor(const svn_delta_editor_t
eb = apr_pcalloc(pool, sizeof(struct dump_edit_baton));
eb->stream = stream;
+ /* Create a special per-revision pool */
+ eb->pool = svn_pool_create(pool);
+
de = svn_delta_default_editor(pool);
de->open_root = open_root;
de->delete_entry = delete_entry;
Re: svn commit: r1002502 -
/subversion/trunk/subversion/svnrdump/dump_editor.c
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
artagnon@apache.org wrote on Wed, Sep 29, 2010 at 07:44:48 -0000:
> Author: artagnon
> Date: Wed Sep 29 07:44:48 2010
> New Revision: 1002502
>
> URL: http://svn.apache.org/viewvc?rev=1002502&view=rev
> Log:
> svnrdump: dump_editor: Followup r1002470 to avoid creating a toplevel
> pool by changing the function that creates the per-revision pool.
>
> * subversion/svnrdump/dump_editor.c
>
> (open_root): Don't create the per-revision pool here. Simply clear
> it after each iteration here.
>
> (get_dump_editor): Create the per-revision pool `eb->pool` here and
> make it a subpool of `pool` so that it's cleaned up when `pool` is
> cleaned up.
>
> 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=1002502&r1=1002501&r2=1002502&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
> +++ subversion/trunk/subversion/svnrdump/dump_editor.c Wed Sep 29 07:44:48 2010
> @@ -368,11 +368,8 @@ open_root(void *edit_baton,
> {
> struct dump_edit_baton *eb = edit_baton;
>
> - /* Special toplevel per-revision pool */
> - if (eb->pool)
> - svn_pool_clear(eb->pool);
> - else
> - eb->pool = svn_pool_create(NULL);
> + /* Clear the per-revision pool after each revision */
> + svn_pool_clear(eb->pool);
>
Need to check for NULL? apr_pool_clear() docs don't bless passing NULL.
> eb->props = apr_hash_make(eb->pool);
> eb->deleted_props = apr_hash_make(eb->pool);
> @@ -852,6 +849,9 @@ get_dump_editor(const svn_delta_editor_t
> eb = apr_pcalloc(pool, sizeof(struct dump_edit_baton));
> eb->stream = stream;
>
> + /* Create a special per-revision pool */
> + eb->pool = svn_pool_create(pool);
> +
So, now the per-revision pool is a subpool of get_dump_editor()'s pool.
Okay.
> de = svn_delta_default_editor(pool);
> de->open_root = open_root;
> de->delete_entry = delete_entry;
>
>
By the way, not directly related to this commit, but do note that we've
last year started with a dual-pool paradigm (where functions take both
a result_pool and a scratch_pool); it's documented in HACKING and in
plenty of examples in new code. Please use that paradigm where
appropriate. Thanks.
Daniel