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

Re: Publicly visible variable _global_svn_swig_py_is_local_pool needs to be properly namespaced.

From: David James <james82_at_gmail.com>
Date: 2005-10-05 18:01:45 CEST

On 10/3/05, David James <james82@gmail.com> wrote:
> On 9/30/05, Max Bowsher <maxb@ukf.net> wrote:
> > The variable _global_svn_swig_py_is_local_pool is publicly visible.
> >
> > Any public symbol ought to be properly namespaced, so it needs to be
> > renamed, possibly to svn_swig_py__global_is_local_pool. What exactly does
> > this variable record? Is there possibly a better name for it?
> Good catch, Max! The _global_svn_swig_py_is_local_pool should not be
> publicly visible. I've attached a patch to make this variable a local
> variable instead of a global one, and also use more comprehensible
> names.
>
> The new names are easier to explain:
> * _global_pool_is_application_pool is true if the current pool was
> initialized to the application pool; it's false otherwise.
> * _global_pool_is_default_pool is true if the current pool was
> initialized to a default subpool; it's false otherwise.
>
> (These variables need to start with the prefix "_global", in order for
> SWIG to process them correctly. SWIG doesn't support any other way of
> indicating that a specific variable can be used across different
> typemaps.)
>
> Here's how we use above variables:
> * In the handler for SWIGTYPE, we overwrite the current python pool
> with a pool grabbed from parameters, if the current pool was
> initialized to the application pool. This allows us to, for example,
> grab the pool parameter from the "repos" object in "svn_repos_fs"
> function.
> * In the input handler for apr_pool_t, we overwrite the current python
> pool with the input pool, if the input pool is not none, and the
> current pool is a default pool. This if statement only occurs when we
> have non-standard pool parameters and the "default" initialization
> function was unable to find the pool parameter. (This trick allows us
> to handle functions with non-standard pool parameters semi-correctly.
> We currently don't have any such functions, because we disallow
> non-standard pool placement in the SWIG Python bindings.)
>
> [[[
>
> Make _global_svn_swig_py_is_local_pool a local variable instead of a global
> variable. Use _global_pool_is_application_pool instead of
> _global_svn_swig_py_is_local_pool. Rename _global_is_default_pool to
> _global_pool_is_application_pool.
>
> * swig/python/libsvn_swig_py/swigutil_py.c
> (_global_svn_swig_py_is_local_pool): Remove.
> * swig/python/libsvn_swig_py/swigutil_py.h
> (_global_svn_swig_py_is_local_pool): Remove.
> * swig/include/svn_global.swg
> (POOLINIT): Declare _global_pool_is_application_pool = 1.
> (void *, SWIGTYPE *, SWIGTYPE []): Use _global_pool_is_application_pool
> instead of _global_svn_swig_py_is_local_pool.
> * swig/include/svn_types.swg
> (apr_pool_t): Use _global_pool_is_application_pool instead of
> _global_svn_swig_py_is_local_pool. Rename _global_is_default_pool to
> _global_pool_is_default_pool.
>
> ]]]
Committed in r16479.

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 5 18:03:26 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.