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

Re: [PATCH] Improved JavaHL pool handling

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: 2007-04-11 23:34:11 CEST

David James wrote:
> On 4/11/07, Hyrum K. Wright <hyrum_wright@mail.utexas.edu> wrote:
>> This patch improves pool handling within the JavaHL bindings. The key
>> idea is to use C++ operator overloading to allow implicit type
>> conversion from a Pool object to an apr_pool_t *. This allows usage of
>> a Pool object wherever an apr_pool_t * would be expected. This change
>> also adds a more OO-esque method of creating and using subpools.
>> This passes all the tests, I just want make this doesn't break things in
>> unknown ways.
> Hi Hyrum,
> Did you attach the latest version of your patch? It looks like you
> didn't do all the stuff in your patch that your log message says it
> did, particularly in Pool.h and Pool.cpp.

Ah, included the wrong log message. Updated one attached.

> Do you also plan to update the other files in JavaHL to use your new
> utility functions (e.g. the destroy and clear functions)? It might be
> nice if you did this all in one patch.

destroy() wasn't added because it isn't needed; the pool gets destroyed
when the Pool object is destroyed.

clear() wasn't used because it will only be used with subpools. I did
not convert subpools to use the Pool class because of a concern about
the way correct way to create the subpool. Using a separate constructor
of the form

    Pool::Pool(const Pool &pool)

would work, except those are the semantics for the copy constructor, and
creating a subpool is not a copy.

The other method is

    Pool Pool::subpool()

but that runs into problems with having multiple Pool objects pointing
to the same apr_pool_t * and then having one go out of scope. It
destroys the pool, and the other object is left hanging. There are ways
around that, and I'm planning on implementing them, but just wanted to
see if there was objection to the general idea of going this route.


JavaHL: Add implicit type conversion to the C++ Pool class, allowing
objects of this class to be directly used wherever a apr_pool_t * is

[ in subversion/bindings/javahl/native/ ]
* Pool.h,
  (operator apr_pool_t * ): Implicit type conversion to an apr_pool_t *.
  (clear): New function which wraps svn_pool_clear().
  (pool): Remove this getter function in favor of the implicit
  conversion to apr_pool_t *.
  (m_pool): Rename from this...
  (pool): ...to this.

* SVNAdmin.cpp,
  Use implicit conversion from Pool to apr_pool_t *.

Received on Wed Apr 11 23:34:38 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.