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

use of svn_pool_ functions

From: Asbjørn Pettersen <asbgpe_at_gmail.com>
Date: 2006-10-13 15:43:58 CEST

I'm still newbie to subversion code, but i have started to read the code.

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);
      return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
                               _("URL '%s' doesn't exist"), session_url);
    else if (kind == svn_node_file)
// ------------- Why not a call destroy() here ?
// svn_pool_destroy(session_pool);
      return svn_error_createf
        (SVN_ERR_UNSUPPORTED_FEATURE , NULL,
         _("URL '%s' refers to a file, not a directory"), session_url);

    /* Get the repos UUID and root URL. */
    SVN_ERR(svn_ra_get_uuid(ra_session, &uuid, pool));
    SVN_ERR(svn_ra_get_repos_root(ra_session, &repos, pool));

    SVN_ERR(svn_io_check_path(path, &kind, pool));

    /* Finished with the RA session -- close up, but not without
       copying out useful information that needs to survive. */
    session_url = apr_pstrdup(pool, session_url);
    uuid = (uuid ? apr_pstrdup(pool, uuid) : NULL);
    repos = (repos ? apr_pstrdup(pool, repos) : NULL);
// OK
    svn_pool_destroy(session_pool);
// ...
Received on Fri Oct 13 15:44:18 2006

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