wrowe 01/04/02 17:22:12
Modified: include apr_buckets.h apr_generic_hook.h apr_optional.h
hooks apr_hooks.c
Log:
Substantial cleanup to the linkage and declarations of the generic
hook creatures [Ben Laurie, Will Rowe]
Revision Changes Path
1.89 +1 -1 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- apr_buckets.h 2001/04/02 19:02:15 1.88
+++ apr_buckets.h 2001/04/03 00:22:07 1.89
@@ -600,7 +600,7 @@
* @param b The bucket brigade to clean up
* @deffunc apr_status_t apr_brigade_cleanup(apr_bucket_brigade *b)
*/
-APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
+APU_DECLARE_NONSTD(apr_status_t) apr_brigade_cleanup(void *data);
/**
* Split a bucket brigade into two, such that the given bucket is the
1.6 +5 -8 apr-util/include/apr_generic_hook.h
Index: apr_generic_hook.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_generic_hook.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- apr_generic_hook.h 2001/02/16 04:17:10 1.5
+++ apr_generic_hook.h 2001/04/03 00:22:08 1.6
@@ -65,9 +65,6 @@
* @package Apache hooks functions
*/
-#define APR_DECLARE_GENERIC_HOOK(ns,ret,name,args) \
-typedef ret ns##_HOOK_##name args;
-
APU_DECLARE(void) apr_hook_generic_add(const char *szName,void (*pfn)(void),
const char * const *aszPre,
const char * const *aszSucc,int nOrder);
@@ -82,8 +79,8 @@
* @param nOrder an integer determining order before honouring aszPre and
aszSucc (for example HOOK_MIDDLE)
*/
-#define APR_HOOK_GENERIC(name,pfn,aszPre,aszSucc,nOrder) \
- ((void (*)(const char *,HOOK_##name *,const char * const *, \
+#define APR_HOOK_GENERIC(ns,name,pfn,aszPre,aszSucc,nOrder) \
+ ((void (*)(const char *,ns##_HOOK_##name##_t *,const char * const *, \
const char * const
*,int))&apr_hook_generic_add)(#name,pfn,aszPre, \
aszSucc, nOrder)
@@ -102,7 +99,7 @@
#define
APR_IMPLEMENT_GENERIC_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline)
\
link##_DECLARE(ret) ns##_run_##name args_decl \
{ \
- ns##_LINK_##name *pHook; \
+ ns##_LINK_##name##_t *pHook; \
int n; \
ret rv; \
apr_array_header_t *pHookArray=apr_hook_generic_get(#name); \
@@ -110,10 +107,10 @@
if(!pHookArray) \
return ok; \
\
- pHook=(ns##_LINK_##name *)pHookArray->elts; \
+ pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
for(n=0 ; n < pHookArray->nelts ; ++n) \
{ \
- rv=pHook[n].pFunc args_use; \
+ rv=(pHook[n].pFunc)args_use; \
\
if(rv != ok && rv != decline) \
return rv; \
1.5 +6 -2 apr-util/include/apr_optional.h
Index: apr_optional.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_optional.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- apr_optional.h 2001/02/22 17:46:49 1.4
+++ apr_optional.h 2001/04/03 00:22:08 1.5
@@ -84,8 +84,12 @@
/* XXX: This doesn't belong here, then!
* Private function! DO NOT USE!
*/
-APU_DECLARE_NONSTD(void) apr_register_optional_fn(const char *szName,void
(*pfn)(void));
+typedef void (apr_opt_fn_t)(void);
+
+APU_DECLARE(void) apr_register_optional_fn(const char *szName, apr_opt_fn_t
*pfn);
+
+
/**
* Register an optional function. This can be later retrieved, type-safely,
by
* name. Like all global functions, the name must be unique. Note that,
@@ -96,7 +100,7 @@
((void (*)(const char *,APR_OPTIONAL_FN_TYPE(name)
*))&apr_register_optional_fn)(#name,name)
/* Private function! DO NOT USE! */
-APU_DECLARE_DATA void (*apr_retrieve_optional_fn(const char *szName))(void);
+APU_DECLARE(apr_opt_fn_t *) apr_retrieve_optional_fn(const char *szName);
/**
* Retrieve an optional function. Returns NULL if the function is not
present.
1.38 +3 -3 apr-util/hooks/apr_hooks.c
Index: apr_hooks.c
===================================================================
RCS file: /home/cvs/apr-util/hooks/apr_hooks.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- apr_hooks.c 2001/02/16 04:17:10 1.37
+++ apr_hooks.c 2001/04/03 00:22:11 1.38
@@ -332,15 +332,15 @@
/* optional function support */
-APU_DECLARE_DATA void (*apr_retrieve_optional_fn(const char *szName))(void)
+APU_DECLARE(apr_opt_fn_t *) apr_retrieve_optional_fn(const char *szName)
{
if(!s_phOptionalFunctions)
return NULL;
return
(void(*)(void))apr_hash_get(s_phOptionalFunctions,szName,strlen(szName));
}
-APU_DECLARE_NONSTD(void) apr_register_optional_fn(const char *szName,
- void (*pfn)(void))
+APU_DECLARE(void) apr_register_optional_fn(const char *szName,
+ apr_opt_fn_t *pfn)
{
if(!s_phOptionalFunctions)
s_phOptionalFunctions=apr_hash_make(apr_global_hook_pool);