You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Gregory Nicholls <gn...@level8.com> on 2001/01/08 19:34:29 UTC

[patch] add APR_DECLARE to function prototypes

Hiya,
    This is part 1 of a multi-part patch to include APR_DECLARE(foo_t) statements for all external APR functions. To aid verification (and reduce the risk of a massive screw-up) I'm
sending a seperate patch for each
functional group starting with apr_pools. I'll wait for approval on this one before submitting the others in turn.
    Gregory Nicholls.

------------------------- cut here ------------------------------------
Index: apr_pools.c
===================================================================
RCS file: /home/cvspublic/apr/lib/apr_pools.c,v
retrieving revision 1.79
diff -u -d -b -r1.79 apr_pools.c
--- apr_pools.c 2001/01/03 04:21:35     1.79
+++ apr_pools.c 2001/01/08 18:24:19
@@ -533,7 +533,7 @@
 #endif

 /* ### why do we have this, in addition to apr_make_sub_pool? */
-apr_status_t apr_create_pool(apr_pool_t **newcont, apr_pool_t *cont)
+APR_DECLARE(apr_status_t) apr_create_pool(apr_pool_t **newcont, apr_pool_t *cont)
 {
     apr_pool_t *newpool;

@@ -663,7 +663,7 @@
     return APR_SUCCESS;
 }

-apr_status_t apr_init_alloc(apr_pool_t *globalp)
+APR_DECLARE(apr_status_t) apr_init_alloc(apr_pool_t *globalp)
 {
 #if APR_HAS_THREADS
     apr_status_t status;
@@ -697,13 +697,13 @@
     return APR_SUCCESS;
 }

-void apr_term_alloc(apr_pool_t *globalp)
+APR_DECLARE(void) apr_term_alloc(apr_pool_t *globalp)
 {
+    apr_destroy_pool(globalp);
 #if APR_HAS_THREADS
     apr_destroy_lock(alloc_mutex);
     apr_destroy_lock(spawn_mutex);
 #endif
-    apr_destroy_pool(globalp);
 }

 /* We only want to lock the mutex if we are being called from apr_clear_pool.
@@ -993,7 +993,7 @@
  * User data management functions
  */

-apr_status_t apr_set_userdata(const void *data, const char *key,
+APR_DECLARE(apr_status_t) apr_set_userdata(const void *data, const char *key,
                              apr_status_t (*cleanup) (void *),
                              apr_pool_t *cont)
 {
@@ -1014,7 +1014,7 @@
     return APR_SUCCESS;
 }

-apr_status_t apr_get_userdata(void **data, const char *key, apr_pool_t *cont)
+APR_DECLARE(apr_status_t) apr_get_userdata(void **data, const char *key, apr_pool_t *cont)
 {
     if (cont->prog_data == NULL)
         *data = NULL;
Index: apr_pools.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_pools.h,v
retrieving revision 1.37
diff -u -d -b -r1.37 apr_pools.h
--- apr_pools.h 2000/12/31 18:04:59     1.37
+++ apr_pools.h 2001/01/08 18:24:29
@@ -215,7 +215,7 @@
  * @tip Programs do NOT need to call this directly.  APR will call this
  *      automatically from apr_initialize.
  */
-apr_status_t apr_init_alloc(apr_pool_t *globalp);      /* Set up everything */
+APR_DECLARE(apr_status_t) apr_init_alloc(apr_pool_t *globalp);       /* Set up everything */

 /**
  * Tear down all of the internal structures required to use pools
@@ -225,7 +225,7 @@
  * @tip Programs do NOT need to call this directly.  APR will call this
  *      automatically from apr_terminate.
  */
-void apr_term_alloc(apr_pool_t *globalp);        /* Tear down everything */
+APR_DECLARE(void) apr_term_alloc(apr_pool_t *globalp);        /* Tear down everything */

 /* pool functions */

@@ -237,7 +237,7 @@
  *        of it's parent pool's attributes, except the apr_pool_t will
  *        be a sub-pool.
  */
-apr_status_t apr_create_pool(apr_pool_t **newcont, apr_pool_t *cont);
+APR_DECLARE(apr_status_t) apr_create_pool(apr_pool_t **newcont, apr_pool_t *cont);

 /**
  * Set the data associated with the current pool
@@ -254,7 +254,7 @@
  *      It is advised that steps are taken to ensure that a unique
  *      key is used at all times.
  */
-apr_status_t apr_set_userdata(const void *data, const char *key,
+APR_DECLARE(apr_status_t) apr_set_userdata(const void *data, const char *key,
                             apr_status_t (*cleanup) (void *),
                             apr_pool_t *cont);

@@ -264,7 +264,7 @@
  * @param key The user data associated with the pool.
  * @param cont The current pool.
  */
-apr_status_t apr_get_userdata(void **data, const char *key, apr_pool_t *cont);
+APR_DECLARE(apr_status_t) apr_get_userdata(void **data, const char *key, apr_pool_t *cont);

 /**
  * make a sub pool from the current pool



Re: [patch] add APR_DECLARE to function prototypes

Posted by rb...@covalent.net.
> Hiya,
>     This is part 1 of a multi-part patch to include APR_DECLARE(foo_t) statements for all external APR functions. To aid verification (and reduce the risk of a massive screw-up) I'm
> sending a seperate patch for each
> functional group starting with apr_pools. I'll wait for approval on this one before submitting the others in turn.

This is a good patch, but it is going to take me some time before I commit
it.  The only problem is with the docs, which is why I can't commit this
immediately.  Basically ScanDoc doesn't have a full C parser in it, so it
doesn't really understand when the return type is surrounded by a macro.

The fix is easy, we just have to add a @deffunc to the ScanDoc sections in
the header files.  If you want to re-submit the patch with those, I'll
commit it tomorrow night, otherwise, I'll just take your patch, and modify
it to have the deffunc's and commit tomorrow night.  :-)

I didn't forget, I've just been busy for the last day or so.  If you are
going to do it, you should be able to find some examples in the current
headers, just search for deffunc.

Thanks for the patch

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------