From: Ben Laurie Date: Sun, 20 May 2001 14:13:33 +0000 (+0000) Subject: AP_ function for optional hooks. X-Git-Tag: 2.0.19~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=883a3b25bfd53808454198d18826dedb2c0686ac;p=thirdparty%2Fapache%2Fhttpd.git AP_ function for optional hooks. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89178 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_config.h b/include/ap_config.h index 3e61ca69f8b..e961a903e42 100644 --- a/include/ap_config.h +++ b/include/ap_config.h @@ -57,6 +57,7 @@ #include "apr.h" #include "apr_hooks.h" +#include "apr_optional_hooks.h" /** * @file ap_config.h @@ -229,6 +230,27 @@ APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \ args_use,decline) +/* Note that the other optional hook implementations are straightforward but + * have not yet been needed + */ + +/** + * Implement an optional hook. This is exactly the same as a standard hook + * implementation, except the hook is optional. + * @see AP_IMPLEMENT_HOOK_RUN_ALL + */ +#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \ + decline) \ + APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \ + args_use,ok,decline) + +/** + * Hook an optional hook. Unlike static hooks, this uses a macro instead of a + * function + */ +#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \ + APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order) + #include "os.h" #ifndef WIN32 #include "ap_config_auto.h" diff --git a/modules/experimental/mod_optional_hook_export.c b/modules/experimental/mod_optional_hook_export.c index e17660572dc..9717a02fd1f 100644 --- a/modules/experimental/mod_optional_hook_export.c +++ b/modules/experimental/mod_optional_hook_export.c @@ -57,8 +57,10 @@ #include "mod_optional_hook_export.h" #include "http_protocol.h" -APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP_MODULE,int,optional_hook_test, +/*APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP_MODULE,int,optional_hook_test, (const char *szStr), + (szStr),OK,DECLINED)*/ +AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,optional_hook_test,(const char *szStr), (szStr),OK,DECLINED) static int ExportLogTransaction(request_rec *r) diff --git a/modules/experimental/mod_optional_hook_export.h b/modules/experimental/mod_optional_hook_export.h index 0510ba0d77c..4e7f3f38913 100644 --- a/modules/experimental/mod_optional_hook_export.h +++ b/modules/experimental/mod_optional_hook_export.h @@ -57,6 +57,6 @@ #include "apr_optional_hooks.h" -APR_DECLARE_EXTERNAL_HOOK(ap,AP_MODULE,int,optional_hook_test,(const char *)) +AP_DECLARE_HOOK(int,optional_hook_test,(const char *)) #endif /* def MOD_OPTIONAL_HOOK_EXPORT_H */ diff --git a/modules/experimental/mod_optional_hook_import.c b/modules/experimental/mod_optional_hook_import.c index 16e64ca77d3..b2c2264080e 100644 --- a/modules/experimental/mod_optional_hook_import.c +++ b/modules/experimental/mod_optional_hook_import.c @@ -67,8 +67,8 @@ static int ImportGenericHookTestHook(const char *szStr) static void ImportRegisterHooks(apr_pool_t *p) { - APR_OPTIONAL_HOOK(ap,optional_hook_test,ImportGenericHookTestHook,NULL, - NULL,APR_HOOK_MIDDLE); + AP_OPTIONAL_HOOK(optional_hook_test,ImportGenericHookTestHook,NULL, + NULL,APR_HOOK_MIDDLE); } module optional_hook_import_module= diff --git a/modules/test/mod_optional_hook_export.c b/modules/test/mod_optional_hook_export.c index e17660572dc..9717a02fd1f 100644 --- a/modules/test/mod_optional_hook_export.c +++ b/modules/test/mod_optional_hook_export.c @@ -57,8 +57,10 @@ #include "mod_optional_hook_export.h" #include "http_protocol.h" -APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP_MODULE,int,optional_hook_test, +/*APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP_MODULE,int,optional_hook_test, (const char *szStr), + (szStr),OK,DECLINED)*/ +AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,optional_hook_test,(const char *szStr), (szStr),OK,DECLINED) static int ExportLogTransaction(request_rec *r) diff --git a/modules/test/mod_optional_hook_export.h b/modules/test/mod_optional_hook_export.h index 0510ba0d77c..4e7f3f38913 100644 --- a/modules/test/mod_optional_hook_export.h +++ b/modules/test/mod_optional_hook_export.h @@ -57,6 +57,6 @@ #include "apr_optional_hooks.h" -APR_DECLARE_EXTERNAL_HOOK(ap,AP_MODULE,int,optional_hook_test,(const char *)) +AP_DECLARE_HOOK(int,optional_hook_test,(const char *)) #endif /* def MOD_OPTIONAL_HOOK_EXPORT_H */ diff --git a/modules/test/mod_optional_hook_import.c b/modules/test/mod_optional_hook_import.c index 16e64ca77d3..b2c2264080e 100644 --- a/modules/test/mod_optional_hook_import.c +++ b/modules/test/mod_optional_hook_import.c @@ -67,8 +67,8 @@ static int ImportGenericHookTestHook(const char *szStr) static void ImportRegisterHooks(apr_pool_t *p) { - APR_OPTIONAL_HOOK(ap,optional_hook_test,ImportGenericHookTestHook,NULL, - NULL,APR_HOOK_MIDDLE); + AP_OPTIONAL_HOOK(optional_hook_test,ImportGenericHookTestHook,NULL, + NULL,APR_HOOK_MIDDLE); } module optional_hook_import_module=