You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Daniel L. Rall" <dl...@apache.org> on 2005/09/10 03:50:20 UTC

[PATCH] clarify return value of hook functions used in request processing

This is a code-clarity improvement only.


* server/request.c
  (ap_process_request_internal): Check the return value of hook
   functions against the constant OK -- defined in httpd.conf as
   "Module has handled this stage" -- instead of against the magic
   number 0 to improve clarity.



Index: server/request.c
===================================================================
--- server/request.c	(revision 279930)
+++ server/request.c	(working copy)
@@ -186,12 +186,12 @@
         switch (ap_satisfies(r)) {
         case SATISFY_ALL:
         case SATISFY_NOSPEC:
-            if ((access_status = ap_run_access_checker(r)) != 0) {
+            if ((access_status = ap_run_access_checker(r)) != OK) {
                 return decl_die(access_status, "check access", r);
             }
 
             if (ap_some_auth_required(r)) {
-                if (((access_status = ap_run_check_user_id(r)) != 0)
+                if (((access_status = ap_run_check_user_id(r)) != OK)
                     || !ap_auth_type(r)) {
                     return decl_die(access_status, ap_auth_type(r)
                                   ? "check user.  No user file?"
@@ -199,7 +199,7 @@
                                   r);
                 }
 
-                if (((access_status = ap_run_auth_checker(r)) != 0)
+                if (((access_status = ap_run_auth_checker(r)) != OK)
                     || !ap_auth_type(r)) {
                     return decl_die(access_status, ap_auth_type(r)
                                   ? "check access.  No groups file?"
@@ -210,12 +210,12 @@
             break;
 
         case SATISFY_ANY:
-            if (((access_status = ap_run_access_checker(r)) != 0)) {
+            if (((access_status = ap_run_access_checker(r)) != OK)) {
                 if (!ap_some_auth_required(r)) {
                     return decl_die(access_status, "check access", r);
                 }
 
-                if (((access_status = ap_run_check_user_id(r)) != 0)
+                if (((access_status = ap_run_check_user_id(r)) != OK)
                     || !ap_auth_type(r)) {
                     return decl_die(access_status, ap_auth_type(r)
                                   ? "check user.  No user file?"
@@ -223,7 +223,7 @@
                                   r);
                 }
 
-                if (((access_status = ap_run_auth_checker(r)) != 0)
+                if (((access_status = ap_run_auth_checker(r)) != OK)
                     || !ap_auth_type(r)) {
                     return decl_die(access_status, ap_auth_type(r)
                                   ? "check access.  No groups file?"
@@ -238,11 +238,11 @@
      * in mod-proxy for r->proxyreq && r->parsed_uri.scheme
      *                              && !strcmp(r->parsed_uri.scheme, "http")
      */
-    if ((access_status = ap_run_type_checker(r)) != 0) {
+    if ((access_status = ap_run_type_checker(r)) != OK) {
         return decl_die(access_status, "find types", r);
     }
 
-    if ((access_status = ap_run_fixups(r)) != 0) {
+    if ((access_status = ap_run_fixups(r)) != OK) {
         return access_status;
     }
 


Re: [PATCH] clarify return value of hook functions used in request processing

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 9/9/05, Daniel L. Rall <dl...@apache.org> wrote:
> This is a code-clarity improvement only.
>
>
> * server/request.c
>   (ap_process_request_internal): Check the return value of hook
>    functions against the constant OK -- defined in httpd.conf as
>    "Module has handled this stage" -- instead of against the magic
>    number 0 to improve clarity.

Thanks, committed in r368505.

-garrett