[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Re: ugly problem found while trying to test KDE SVN

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-02-28 00:24:10 CET

Eric Gillespie <epg@pretzelnet.org> writes:

> @@ -238,29 +239,39 @@
> svn_fs_t *fs = svn_fs_fs__dag_get_fs (node);
> dag_node_t *this_node;
> svn_boolean_t done = FALSE;
> + apr_pool_t *last_iterpool, *new_iterpool;
>
> + last_iterpool = svn_pool_create (pool);
> this_node = node;
> while ((! done) && this_node)
> {
> node_revision_t *noderev;
>
> + new_iterpool = svn_pool_create (pool);
> +
> /* Get the node revision for THIS_NODE so we can examine its
> predecessor id. */
> - SVN_ERR (get_node_revision (&noderev, this_node, pool));
> + SVN_ERR (get_node_revision (&noderev, this_node, new_iterpool));
>
> + apr_pool_destroy (last_iterpool);
> +
> /* If THIS_NODE has a predecessor, replace THIS_NODE with the
> precessor, else set it to NULL. */
> if (noderev->predecessor_id)
> SVN_ERR (svn_fs_fs__dag_get_node (&this_node, fs,
> - noderev->predecessor_id, pool));
> + noderev->predecessor_id,
> + new_iterpool));
> else
> this_node = NULL;
>
> /* Now call the user-supplied callback with our predecessor
> node. */
> if (callback)
> - SVN_ERR (callback (baton, this_node, &done, pool));
> + SVN_ERR (callback (baton, this_node, &done, new_iterpool));
> +
> + last_iterpool = new_iterpool;
> }
> + apr_pool_destroy (last_iterpool);
>
> return SVN_NO_ERROR;
> }

Assumming _clear is "better" than _create/_destroy, how about:

          last_iterpool = svn_pool_create (...);
          iterpool = svn_pool_create (...);

          while (...)
            {
               apr_pool_t *tmp_iterpool = last_iterpool;
               last_iterpool = iterpool;
               iterpool = tmp_iterpool;
               svn_pool_clear (iterpool);
               /* Allocations from iterpool will remain valid on the
                  next iteration. */

               ...
            }

          svn_pool_destroy (iterpool);
          svn_pool_destroy (last_iterpool);

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Feb 28 00:25:37 2005

This is an archived mail posted to the Subversion Dev mailing list.