From 2a463b3cd73c32ee9dcd508248d0194923f435f4 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sat, 29 Mar 2014 21:56:19 +0100 Subject: Imported Upstream version 2.4.9 --- docs/manual/developer/hooks.html.en | 56 ++++++++++++------------------------- 1 file changed, 18 insertions(+), 38 deletions(-) (limited to 'docs/manual/developer/hooks.html.en') diff --git a/docs/manual/developer/hooks.html.en b/docs/manual/developer/hooks.html.en index 43cf1cca..f6482901 100644 --- a/docs/manual/developer/hooks.html.en +++ b/docs/manual/developer/hooks.html.en @@ -9,7 +9,7 @@ - @@ -49,9 +49,7 @@ arguments. For example, if the hook returns an int and takes a request_rec * and an int and is called do_something, then declare it like this:

-
-        AP_DECLARE_HOOK(int, do_something, (request_rec *r, int n))
-      
+
AP_DECLARE_HOOK(int, do_something, (request_rec *r, int n))

This should go in a header which modules will include if @@ -63,12 +61,10 @@ which is used to record the module functions that use the hook. This is declared as follows:

-
-APR_HOOK_STRUCT(
+      
APR_HOOK_STRUCT(
   APR_HOOK_LINK(do_something)
   ...
-)
-      
+)
@@ -82,9 +78,7 @@ APR_HOOK_STRUCT(

If the return value of a hook is void, then all the hooks are called, and the caller is implemented like this:

-
-          AP_IMPLEMENT_HOOK_VOID(do_something, (request_rec *r, int n), (r, n))
-        
+
AP_IMPLEMENT_HOOK_VOID(do_something, (request_rec *r, int n), (r, n))

The second and third arguments are the dummy argument @@ -92,13 +86,11 @@ APR_HOOK_STRUCT( calling the hook. In other words, this macro expands to something like this:

-
-void ap_run_do_something(request_rec *r, int n)
+        
void ap_run_do_something(request_rec *r, int n)
 {
     ...
     do_something(r, n);
-}
-        
+}
@@ -106,9 +98,7 @@ void ap_run_do_something(request_rec *r, int n)

If the hook returns a value, then it can either be run until the first hook that does something interesting, like so:

-
-          AP_IMPLEMENT_HOOK_RUN_FIRST(int, do_something, (request_rec *r, int n), (r, n), DECLINED)
-        
+
AP_IMPLEMENT_HOOK_RUN_FIRST(int, do_something, (request_rec *r, int n), (r, n), DECLINED)

The first hook that does not return DECLINED @@ -124,9 +114,7 @@ void ap_run_do_something(request_rec *r, int n) value other than one of those two stops the loop, and its return is the return value. Declare these like so:

-
-          AP_IMPLEMENT_HOOK_RUN_ALL(int, do_something, (request_rec *r, int n), (r, n), OK, DECLINED)
-        
+
AP_IMPLEMENT_HOOK_RUN_ALL(int, do_something, (request_rec *r, int n), (r, n), OK, DECLINED)

Again, OK and DECLINED are the traditional @@ -138,12 +126,10 @@ void ap_run_do_something(request_rec *r, int n)

At appropriate moments in the code, call the hook caller, like so:

-
-int n, ret;
+      
int n, ret;
 request_rec *r;
 
-ret=ap_run_do_something(r, n);
-      
+ret=ap_run_do_something(r, n);
top
@@ -156,13 +142,11 @@ ret=ap_run_do_something(r, n);

Include the appropriate header, and define a static function of the correct type:

-
-static int my_something_doer(request_rec *r, int n)
+
static int my_something_doer(request_rec *r, int n)
{ ... return OK; -} -
+}
@@ -171,8 +155,7 @@ static int my_something_doer(request_rec *r, int n)
registering function, which is included in the module structure:

-
-static void my_register_hooks()
+      
static void my_register_hooks()
 {
     ap_hook_do_something(my_something_doer, NULL, NULL, APR_HOOK_MIDDLE);
 }
@@ -181,8 +164,7 @@ mode MODULE_VAR_EXPORT my_module =
 {
     ...
     my_register_hooks       /* register hooks */
-};
-      
+};
@@ -215,14 +197,12 @@ mode MODULE_VAR_EXPORT my_module = example, suppose we want "mod_xyz.c" and "mod_abc.c" to run before we do, then we'd hook as follows:

-
-static void register_hooks()
+      
static void register_hooks()
 {
     static const char * const aszPre[] = { "mod_xyz.c", "mod_abc.c", NULL };
 
     ap_hook_do_something(my_something_doer, aszPre, NULL, APR_HOOK_MIDDLE);
-}
-      
+}

Note that the sort used to achieve this is stable, so @@ -251,7 +231,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/developer/hooks.html } })(window, document); //-->