You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Stas Bekman <st...@stason.org> on 2003/09/25 09:01:05 UTC

[doc patch] clarify the issue with uniqueness of the key in apr_pool_userdata_set

Hopefully this makes things less confusing.

Index: include/apr_pools.h
===================================================================
RCS file: /home/cvs/apr/include/apr_pools.h,v
retrieving revision 1.103
diff -u -r1.103 apr_pools.h
--- include/apr_pools.h 11 Mar 2003 20:02:06 -0000      1.103
+++ include/apr_pools.h 25 Sep 2003 06:59:47 -0000
@@ -445,7 +445,7 @@
   * @return The parent of the given pool.
   */
  APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool);
-
+
  /** @deprecated @see apr_pool_parent_get */
  APR_DECLARE(apr_pool_t *) apr_pool_get_parent(apr_pool_t *pool);

@@ -483,7 +483,8 @@
   *      use for their data.  It is possible to accidentally overwrite
   *      data by choosing a key that another part of the program is using
   *      It is advised that steps are taken to ensure that a unique
- *      key is used at all times.
+ *      key is used at all times. This is of course inside one pool;
+ *      Two pools, or a pool and sub-pool can use identical keys.
   * @bug Specify how to ensure this uniqueness!
   */
  APR_DECLARE(apr_status_t) apr_pool_userdata_set(


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [doc patch] clarify the issue with uniqueness of the key in apr_pool_userdata_set

Posted by Stas Bekman <st...@stason.org>.
Cliff Woolley wrote:
> On Thu, 25 Sep 2003, Stas Bekman wrote:
> 
> 
>>Hopefully this makes things less confusing.
> 
> 
>>   *      use for their data.  It is possible to accidentally overwrite
>>   *      data by choosing a key that another part of the program is using
>>   *      It is advised that steps are taken to ensure that a unique
>>- *      key is used at all times.
>>+ *      key is used at all times. This is of course inside one pool;
>>+ *      Two pools, or a pool and sub-pool can use identical keys.
> 
> 
> Getting better... how about:
> 
> "... It is advised that steps are taken to ensure that unique keys are
> used for all of the userdata objects in a given pool at all times.
> Careful namespace prefixing of key names typically helps to ensure this
> uniqueness."

+1

Though I'd double overstress that one doesn't have to ensure uniqueness across 
two pools, and even a pool and its sub-pool.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [doc patch] clarify the issue with uniqueness of the key in apr_pool_userdata_set

Posted by Cliff Woolley <jw...@virginia.edu>.
On Thu, 25 Sep 2003, Stas Bekman wrote:

> Hopefully this makes things less confusing.

>    *      use for their data.  It is possible to accidentally overwrite
>    *      data by choosing a key that another part of the program is using
>    *      It is advised that steps are taken to ensure that a unique
> - *      key is used at all times.
> + *      key is used at all times. This is of course inside one pool;
> + *      Two pools, or a pool and sub-pool can use identical keys.

Getting better... how about:

"... It is advised that steps are taken to ensure that unique keys are
used for all of the userdata objects in a given pool at all times.
Careful namespace prefixing of key names typically helps to ensure this
uniqueness."

--Cliff