On Sat, Oct 24, 2009 at 18:42, Julian Foad <julianfoad_at_btopenworld.com> wrote:
> Greg Stein wrote:
>> On Sat, Oct 24, 2009 at 08:35, Hyrum K. Wright <hyrum_at_hyrumwright.org> wrote:
>> >...
>> > +++ trunk/subversion/svn/proplist-cmd.c Sat Oct 24 05:35:12 2009 Â Â Â Â (r40218)
>> >...
>> >  else  /* operate on normal, versioned properties (not revprops) */
>> > Â Â {
>> > - Â Â Â apr_pool_t *subpool = svn_pool_create(pool);
>> > + Â Â Â apr_pool_t *iterpool;
>> > Â Â Â svn_proplist_receiver_t pl_receiver;
>> >
>> > Â Â Â if (opt_state->xml)
>> > Â Â Â Â {
>> > - Â Â Â Â Â SVN_ERR(svn_cl__xml_print_header("properties", pool));
>> > + Â Â Â Â Â SVN_ERR(svn_cl__xml_print_header("properties", scratch_pool));
>> > Â Â Â Â Â pl_receiver = proplist_receiver_xml;
>> > Â Â Â Â }
>> > Â Â Â else
>> > @@ -181,6 +180,7 @@ svn_cl__proplist(apr_getopt_t *os,
>> > Â Â Â if (opt_state->depth == svn_depth_unknown)
>> > Â Â Â Â opt_state->depth = svn_depth_empty;
>> >
>> > + Â Â Â iterpool = svn_pool_create(scratch_pool);
>> > Â Â Â for (i = 0; i < targets->nelts; i++)
>>
>> If you construct the iterpool in the declaration (as before), then you
>> can use it for the call to svn_cl__xml_print_header(), as its
>> scratch_pool. Any mem used by the call will be cleared on the first
>> iteration of the loop.
>>
>> >...
>> > @@ -204,17 +204,16 @@ svn_cl__proplist(apr_getopt_t *os,
>> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â opt_state->depth,
>> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â opt_state->changelists,
>> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pl_receiver, &pl_baton,
>> > - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ctx, subpool),
>> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ctx, iterpool),
>> > Â Â Â Â Â Â Â Â Â Â NULL, opt_state->quiet,
>> > Â Â Â Â Â Â Â Â Â Â SVN_ERR_UNVERSIONED_RESOURCE,
>> > Â Â Â Â Â Â Â Â Â Â SVN_ERR_ENTRY_NOT_FOUND,
>> > Â Â Â Â Â Â Â Â Â Â SVN_NO_ERROR));
>> > Â Â Â Â }
>> > + Â Â Â svn_pool_destroy(iterpool);
>> >
>> > Â Â Â if (opt_state->xml)
>> > - Â Â Â Â SVN_ERR(svn_cl__xml_print_footer("properties", pool));
>> > -
>> > - Â Â Â svn_pool_destroy(subpool);
>> > + Â Â Â Â SVN_ERR(svn_cl__xml_print_footer("properties", scratch_pool));
>> > Â Â }
>> >
>> > Â return SVN_NO_ERROR;
>>
>> And if you don't destroy it so soon, then you get to use it for that
>> last call, too.
> [...]
>
> That's true, there is the opportunity to do that, but is it really worth
> breaking the well-defined "iterpool" pattern for such a little extra
> optimisation? I don't think so. Keep it simple.
Eh? How does it break it?
You alloc the iterpool. clear it at the start of each iteration.
destroy it later. I see no change to that.
Cheers,
-g
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2411124
Received on 2009-10-25 04:20:05 CET