apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr CHANGES
Date Mon, 29 Oct 2001 14:54:19 GMT
wrowe       01/10/29 06:54:19

  Modified:    include  apr_pools.h
               memory/unix apr_pools.c
               .        CHANGES
  Log:
    Introduce the apr_pool_userdata_setn() variant that doesn't strdup the key.
  
    Support for passing NULL as the cleanup callback, so items that don't
    require a cleanup need not incur the overhead of registering a no-op.
  
  Submitted by:	Brian Pane <bpane@pacbell.net>
  
  Revision  Changes    Path
  1.62      +19 -1     apr/include/apr_pools.h
  
  Index: apr_pools.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_pools.h,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- apr_pools.h	2001/09/28 15:22:35	1.61
  +++ apr_pools.h	2001/10/29 14:54:18	1.62
  @@ -264,7 +264,7 @@
    * Set the data associated with the current pool
    * @param data The user data associated with the pool.
    * @param key The key to use for association
  - * @param cleanup The cleanup program to use to cleanup the data
  + * @param cleanup The cleanup program to use to cleanup the data (NULL if none)
    * @param cont The current pool
    * @warning The data to be attached to the pool should have a life span
    *          at least as long as the pool it is being attached to.
  @@ -280,6 +280,24 @@
   						const char *key,
   						apr_status_t (*cleanup)(void *),
   						apr_pool_t *cont);
  +
  +/**
  + * Set the data associated with the current pool
  + * @param data The user data associated with the pool.
  + * @param key The key to use for association
  + * @param cleanup The cleanup program to use to cleanup the data (NULL if none)
  + * @param cont The current pool
  + * @note same as apr_pool_userdata_set(), except that this version doesn't
  + *       make a copy of the key (this function is useful, for example, when
  + *       the key is a string literal)
  + * @warning The key and the data to be attached to the pool should have
  + *       a life span at least as long as the pool itself.
  + *
  + */
  +APR_DECLARE(apr_status_t) apr_pool_userdata_setn(const void *data,
  +                                                 const char *key,
  +                                                 apr_status_t (*cleanup)(void *),
  +                                                 apr_pool_t *cont);
   
   /**
    * Return the data associated with the current pool.
  
  
  
  1.115     +20 -1     apr/memory/unix/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- apr_pools.c	2001/10/23 17:30:08	1.114
  +++ apr_pools.c	2001/10/29 14:54:19	1.115
  @@ -1284,7 +1284,26 @@
           apr_hash_set(cont->prog_data, key, keylen, data);
       }
   
  -    apr_pool_cleanup_register(cont, data, cleanup, cleanup);
  +    if (cleanup) {
  +        apr_pool_cleanup_register(cont, data, cleanup, cleanup);
  +    }
  +    return APR_SUCCESS;
  +}
  +
  +APR_DECLARE(apr_status_t) apr_pool_userdata_setn(const void *data, const char *key,
  +       apr_status_t (*cleanup) (void *),
  +       apr_pool_t *cont)
  +{
  +    apr_size_t keylen = strlen(key);
  +
  +    if (cont->prog_data == NULL)
  +        cont->prog_data = apr_hash_make(cont);
  +
  +    apr_hash_set(cont->prog_data, key, keylen, data);
  +
  +    if (cleanup) {
  +        apr_pool_cleanup_register(cont, data, cleanup, cleanup);
  +    }
       return APR_SUCCESS;
   }
   
  
  
  
  1.176     +4 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.175
  retrieving revision 1.176
  diff -u -r1.175 -r1.176
  --- CHANGES	2001/10/23 17:30:07	1.175
  +++ CHANGES	2001/10/29 14:54:19	1.176
  @@ -1,5 +1,9 @@
   Changes with APR b1  
   
  +  *) Introduce the apr_pool_userdata_setn() variant that doesn't 
  +     strdup the key.  Allows both the _setn() and _set() variant to 
  +     accept NULL for the cleanup.  [Brian Pane <bpane@pacbell.net]
  +
     *) Re-vamp the apr_proc_wait and apr_proc_wait_all functions.  We
        now return the exit code from the program and a reason that the
        program died, either normal exit or signalled.
  
  
  

Mime
View raw message