Hi,

the patch below simplifies mod_perl.c a bit.

Instead of

modperl_response_handler_run(r, finish) {
  do something
  if( finish ) {
    modperl_response_finish()
  }
}

and calling that function in one place as

modperl_response_handler_run(r, TRUE)

and in the second place as

modperl_response_handler_run(r, TRUE)
do something
modperl_response_finish()

it now looks like

modperl_response_handler_run(r) {
  do something
}

1st usage:
modperl_response_handler_run(r)
modperl_response_finish()

2nd usage:
modperl_response_handler_run(r)
do something
modperl_response_finish()

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c	(revision 929182)
+++ src/modules/perl/mod_perl.c	(working copy)
@@ -991,7 +991,7 @@
     return modperl_wbucket_flush(rcfg->wbucket, FALSE);
 }
 
-static int modperl_response_handler_run(request_rec *r, int finish)
+static int modperl_response_handler_run(request_rec *r)
 {
     int retval;
 
@@ -1003,13 +1003,6 @@
         r->handler = r->content_type; /* let http_core or whatever try */
     }
 
-    if (finish) {
-        apr_status_t rc = modperl_response_finish(r);
-        if (rc != APR_SUCCESS) {
-            retval = rc;
-        }
-    }
-
     return retval;
 }
 
@@ -1043,7 +1036,13 @@
         modperl_env_request_populate(aTHX_ r);
     }
 
-    retval = modperl_response_handler_run(r, TRUE);
+    retval = modperl_response_handler_run(r);
+    {
+        apr_status_t rc = modperl_response_finish(r);
+        if (rc != APR_SUCCESS) {
+            retval = rc;
+        }
+    }
 
 #ifdef USE_ITHREADS
     if (MpInterpPUTBACK(interp)) {
@@ -1099,7 +1098,7 @@
 
     modperl_env_request_tie(aTHX_ r);
 
-    retval = modperl_response_handler_run(r, FALSE);
+    retval = modperl_response_handler_run(r);
 
     modperl_env_request_untie(aTHX_ r);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org

Reply via email to