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

Re: use of svn_pool_ functions

From: Asbjørn Pettersen <asbgpe_at_gmail.com>
Date: 2006-10-13 21:44:24 CEST

Ok, not so critical i hope. (If the calling functions doesn't looping then)

Here is another example from svnsync's main.c:

 pool = svn_pool_create(NULL);
  err = svn_ra_initialize(pool);
  if (err)
    {
      svn_handle_error2(err, stderr, FALSE, "svnsync: ");
// no destoy here either?
      return EXIT_FAILURE;
    }
....
//
if (err)
    {
      /* Fix up stupid default error strings. */
      if (err->apr_err == SVN_ERR_CL_INSUFFICIENT_ARGS)
        {
          svn_error_clear(err);
          err = svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, NULL,
                                 _("Not enough arguments provided; "
                                   "try 'svnsync help' for more info"));
        }
      svn_handle_error2(err, stderr, FALSE, "svnsync: ");
      svn_error_clear(err);
// no destoy here
      return EXIT_FAILURE;
    }

.....

On 10/13/06, Peter Lundblad <plundblad@google.com> wrote:
>
> Asbjørn Pettersen writes:
> > I'm a little confused by the use of the svn_pool_create() and
> > svn_pool_destroy() functions.
> > The svn_pool_destroy() isn't always called !? especially on "subpools".
> > The SVN_ERR() also return without calling destroy()
> >
> >
> > Example:
> > subversion/subversion/libsvn_client/checkout.c
> >
> > svn_client__checkout_internal()
> > {
> > // ....
> > apr_pool_t *session_pool = svn_pool_create(pool);
> >
> > /* Get the RA connection. */
> > SVN_ERR(svn_client__ra_session_from_path(&ra_session, &revnum,
> > &session_url, url,
> > peg_revision, revision,
> ctx,
> > session_pool));
> >
> > SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
> > if (kind == svn_node_none)
> > // ------------- Why not a call destroy() here ?
> > // svn_pool_destroy(session_pool);
>
> Because the parent pool will destroy the subpool eventually, and in the
> error case, this is expected to happen quite soon. This avoids code
> cluttering a lot. There's some information of pool usage in hacking.
>
> Regards,
> //Peter
>
Received on Fri Oct 13 21:44:41 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.