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

[PATCH]: Fix some pool usage (non-use of sub-pools)

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-01-28 19:54:28 CET

I came across these while going through Michael Price's patch for issue #1310.

Log message:
[[[
Fix some pool usage.

* subversion/libsvn_client/add.c
   (svn_client_mkdir): Actually use the sub-pool that we created. Clear it at
     at the beginning rather than the end of the loop, as per our policy.

* subversion/mod_dav_svn/repos.c
   (dav_svn_do_walk): Remove the unused sub-pool, as no pool is needed.
]]]

- Julian

Fix some pool usage.

* subversion/libsvn_client/add.c
  (svn_client_mkdir): Actually use the sub-pool that we created. Clear it at
    at the beginning rather than the end of the loop, as per our policy.

* subversion/mod_dav_svn/repos.c
  (dav_svn_do_walk): Remove the unused sub-pool, as no pool is needed.

Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 12864)
+++ subversion/libsvn_client/add.c (working copy)
@@ -621,12 +621,14 @@ svn_client_mkdir (svn_client_commit_info
         {
           const char *path = APR_ARRAY_IDX (paths, i, const char *);
 
+ svn_pool_clear (subpool);
+
           /* See if the user wants us to stop. */
           if (ctx->cancel_func)
             SVN_ERR (ctx->cancel_func (ctx->cancel_baton));
 
- SVN_ERR (svn_io_dir_make (path, APR_OS_DEFAULT, pool));
- err = svn_client_add (path, FALSE, ctx, pool);
+ SVN_ERR (svn_io_dir_make (path, APR_OS_DEFAULT, subpool));
+ err = svn_client_add (path, FALSE, ctx, subpool);
 
           /* We just created a new directory, but couldn't add it to
              version control. Don't leave unversioned directoies behind. */
@@ -635,11 +637,9 @@ svn_client_mkdir (svn_client_commit_info
               /* ### If this returns an error, should we link it onto
                  err instead, so that the user is warned that we just
                  created an unversioned directory? */
- svn_error_clear (svn_io_remove_dir (path, pool));
+ svn_error_clear (svn_io_remove_dir (path, subpool));
               return err;
             }
-
- svn_pool_clear (subpool);
         }
       svn_pool_destroy (subpool);
     }
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c (revision 12864)
+++ subversion/mod_dav_svn/repos.c (working copy)
@@ -2608,7 +2608,6 @@ static dav_error * dav_svn_do_walk(dav_s
   apr_size_t uri_len;
   apr_size_t repos_len;
   apr_hash_t *children;
- apr_pool_t *params_subpool;
 
   /* The current resource is a collection (possibly here thru recursion)
      and this is the invocation for the collection. Alternatively, this is
@@ -2662,8 +2661,6 @@ static dav_error * dav_svn_do_walk(dav_s
   repos_len = ctx->repos_path->len;
 
   /* fetch this collection's children */
- params_subpool = svn_pool_create(params->pool);
-
   serr = svn_fs_dir_entries(&children, ctx->info.root.root,
                             ctx->info.repos_path, params->pool);
   if (serr != NULL)
@@ -2726,12 +2723,8 @@ static dav_error * dav_svn_do_walk(dav_s
       ctx->info.uri_path->len = path_len;
       ctx->uri->len = uri_len;
       ctx->repos_path->len = repos_len;
-
- svn_pool_clear(params_subpool);
     }
 
- svn_pool_destroy(params_subpool);
-
   return NULL;
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jan 28 19:55:41 2005

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.