[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: Daniel Rall <dlr_at_collab.net>
Date: 2006-10-06 21:53:50 CEST

Use of a NULL pool with apr_hash_first() is fine so long as your
apr_hash_t is only accessed by one thread at a time. Is that the case
here?

On Sat, 07 Oct 2006, Kamesh Jayachandran wrote:

> Hi All,
> 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.
> With this change I ran 'make check FS_TYPE=bdb' and observed same
> behaviour without this change.
>
> Can someone consider this patch?
>
> With regards
> Kamesh Jayachandran

> [[[
> Patch by: Kamesh Jayachandran <kamesh@collab.net>
>
> Why to create subpool to iterate the apr_hash_t rather iterate with
> a NULL as pool.
>
> * subversion/libsvn_fs_base/tree.c
> (base_dir_entries):
> Don't create subpool to iterate over the apr_hash_t rather pass NULL as
> pool to apr_hash_first.
>
> ]]]

> 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;

  • application/pgp-signature attachment: stored
Received on Fri Oct 6 21:55:22 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.