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

Re: [PATCH] Destroy the APR subpools

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2007-04-04 15:00:40 CEST

Bhuvaneswaran Arumugam wrote:
> Thanks for the review comments Mike. Please find attached the revised
> patch incorporating your comments. In addition, I've also bumped the
> copyright year to 2007 in this patch.

[...]

> @@ -138,14 +138,15 @@
> int i = 0;
> void *parent_db = NULL, *db = NULL;
> const char *path;
> - apr_pool_t *subpool = svn_pool_create(pool);
> - apr_pool_t *iterpool = svn_pool_create(pool);
> - dir_stack_t *item = apr_pcalloc(subpool, sizeof(*item));
>
> /* Do nothing if there are no paths. */
> if (! paths->nelts)
> return SVN_NO_ERROR;
>
> + apr_pool_t *subpool = svn_pool_create(pool);
> + apr_pool_t *iterpool = svn_pool_create(pool);
> + dir_stack_t *item = apr_pcalloc(subpool, sizeof(*item));
> +
> /* Sort the paths in a depth-first directory-ish order. */
> qsort(paths->elts, paths->nelts, paths->elt_size, svn_sort_compare_paths);

This won't work in strict C compilers -- you can't have declarations
following code in a function body. You'll want:

   apr_pool_t *subpool, *iterpool;
   dir_stack_t *item;

   if (! paths->nelts)
     return SVN_NO_ERROR;

   subpool = svn_pool_create(pool);
   iterpool = svn_pool_create(pool);
   item = apr_pcalloc(subpool, sizeof(*item));

With those changes, +1 to commit.

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Wed Apr 4 15:01:03 2007

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.