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

Re: libsvn_wc (status.c) result_pool/scratch_pool

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 28 Sep 2009 11:36:40 +0100

On Sat, 2009-09-26, Hyrum K. Wright wrote:
> On Sep 26, 2009, at 1:06 PM, Martin Hauner wrote:
> > there is one place in moving libsvn_wc/status.c to result_pool/
> > scratch_pool where I'm not sure what to do.
> >
> > status.c has the following function:
> >
> > static svn_error_t *
> > close_directory(void *dir_baton,
> > apr_pool_t *scratch_pool)
> >
> >
> > All pool usages are fine with scratch_pool but a single line looks
> > like a
> > result_pool:
> >
> > (currently line 1865)
> >
> > eb->anchor_status->ood_last_cmt_author =
> > apr_pstrdup(pool, db->ood_last_cmt_author);

If that allocation is being used to store results for use after the
function returns, then the pool is a "result pool". There is no harm in
a result pool also being used to hold some scratch data, so the solution
is to change the function's prototype to

static svn_error_t *
close_directory(void *dir_baton,
                apr_pool_t *result_pool)

(Or just leave it as "pool" and add a comment explaining why.)

- Julian

> >
> >
> > So close_directory would need both pool parameters. But it is an
> > implementation of:
> >
> > include/svn_delta.h
> >
> > svn_error_t *(*close_directory)(void *dir_baton,
> > apr_pool_t *pool);
> >
> >
> > I guess we don't want to change this.. ?
>
> Correct. We'll need to change the editor (which is also happening at
> some point).
>
> -Hyrum
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2400683

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2401140
Received on 2009-09-28 12:37:00 CEST

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.