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

Re: [PATCH] why not loop through apr_hash_t with pool as NULL.

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2006-10-06 23:11:09 CEST

Kamesh Jayachandran <kamesh@collab.net> writes:

> Found a snippet of code in subversion/libsvn_fs_base/tree.c where we
> create a separate subpool which is passed to apr_hash_first alone. And
> this subpool can be replaced by NULL.

Not thread safe.

> Index: subversion/libsvn_fs_base/tree.c
> ===================================================================
> --- subversion/libsvn_fs_base/tree.c (revision 21795)
> +++ subversion/libsvn_fs_base/tree.c (working copy)
> @@ -1465,8 +1465,7 @@
> if (table)
> {
> apr_hash_index_t *hi;
> - apr_pool_t *subpool = svn_pool_create(pool);
> - for (hi = apr_hash_first(subpool, table); hi; hi = apr_hash_next(hi))
> + for (hi = apr_hash_first(NULL, table); hi; hi = apr_hash_next(hi))
> {
> svn_fs_dirent_t *entry;
> struct node_kind_args nk_args;

The way the subpool is used looks wrong. Why is the subpool used at
all? Surely the overhead for a single iterator is small enough to
come out of pool. If the subpool is required why is it not cleared
and destroyed?

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 6 23:11:31 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.