You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Max Bowsher <ma...@ukf.net> on 2005/09/30 23:41:31 UTC

Publicly visible variable _global_svn_swig_py_is_local_pool needs to be properly namespaced.

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?

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by David James <ja...@gmail.com>.
On 9/30/05, Max Bowsher <ma...@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?
The attached patch removes
--
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


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

Posted by Max Bowsher <ma...@ukf.net>.
David James wrote:
> On 10/3/05, David James <ja...@gmail.com> wrote:
>> Here's how we use above variables:
...

Thanks - that was a useful explanation.

> Committed in r16479.

And please propose for backport too.


Thanks,

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by David James <ja...@gmail.com>.
On 10/3/05, David James <ja...@gmail.com> wrote:
> On 9/30/05, Max Bowsher <ma...@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


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

Posted by David James <ja...@gmail.com>.
On 9/30/05, Max Bowsher <ma...@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.

]]]


--
David James -- http://www.cs.toronto.edu/~james