httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1205894 - in /httpd/httpd/trunk: include/util_filter.h modules/cache/mod_cache.c server/util_filter.c
Date Thu, 24 Nov 2011 15:53:17 GMT
Author: jim
Date: Thu Nov 24 15:53:16 2011
New Revision: 1205894

URL: http://svn.apache.org/viewvc?rev=1205894&view=rev
Log:
Use varargs...

Modified:
    httpd/httpd/trunk/include/util_filter.h
    httpd/httpd/trunk/modules/cache/mod_cache.c
    httpd/httpd/trunk/server/util_filter.c

Modified: httpd/httpd/trunk/include/util_filter.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_filter.h?rev=1205894&r1=1205893&r2=1205894&view=diff
==============================================================================
--- httpd/httpd/trunk/include/util_filter.h (original)
+++ httpd/httpd/trunk/include/util_filter.h Thu Nov 24 15:53:16 2011
@@ -322,8 +322,8 @@ AP_DECLARE(apr_status_t) ap_pass_brigade
  *         ::HTTP_INTERNAL_SERVER_ERROR on all other errors
  * @param r      The request rec
  * @param bucket The current bucket brigade
- * @param msg    Optional error msg; if NULL defaults to "ap_pass_brigade returned"
- *
+ * @param fmt The format string. If NULL defaults to "ap_pass_brigade returned"
+ * @param ... The arguments to use to fill out the format string
  * @remark Ownership of the brigade is retained by the caller. On return,
  *         the contents of the brigade are UNDEFINED, and the caller must
  *         either call apr_brigade_cleanup or apr_brigade_destroy on
@@ -331,7 +331,8 @@ AP_DECLARE(apr_status_t) ap_pass_brigade
  */
 AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
                                               apr_bucket_brigade *bucket,
-                                              const char *msg);
+                                              const char *fmt,
+                                              ...);
 
 
 /**
@@ -574,7 +575,7 @@ AP_DECLARE_NONSTD(apr_status_t) ap_fputs
  * @param f the filter we are writing to
  * @param bb The brigade to buffer into
  * @param fmt The format string
- * @param ... The argumets to use to fill out the format string
+ * @param ... The arguments to use to fill out the format string
  */
 AP_DECLARE_NONSTD(apr_status_t) ap_fprintf(ap_filter_t *f,
                                            apr_bucket_brigade *bb,

Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1205894&r1=1205893&r2=1205894&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Thu Nov 24 15:53:16 2011
@@ -294,9 +294,8 @@ static int cache_quick_handler(request_r
     APR_BRIGADE_INSERT_TAIL(out, e);
 
     return ap_pass_brigade_fchk(r, out,
-                                apr_psprintf(r->pool,
-                                             "cache_quick_handler(%s): ap_pass_brigade returned",
-                                             cache->provider_name));
+                                "cache_quick_handler(%s): ap_pass_brigade returned",
+                                cache->provider_name);
 }
 
 /**
@@ -568,10 +567,8 @@ static int cache_handler(request_rec *r)
     out = apr_brigade_create(r->pool, r->connection->bucket_alloc);
     e = apr_bucket_eos_create(out->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(out, e);
-    return ap_pass_brigade_fchk(r, out,
-                                apr_psprintf(r->pool,
-                                             "cache(%s): ap_pass_brigade returned",
-                                             cache->provider_name));
+    return ap_pass_brigade_fchk(r, out, "cache(%s): ap_pass_brigade returned",
+                                cache->provider_name);
 }
 
 /*

Modified: httpd/httpd/trunk/server/util_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_filter.c?rev=1205894&r1=1205893&r2=1205894&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_filter.c (original)
+++ httpd/httpd/trunk/server/util_filter.c Thu Nov 24 15:53:16 2011
@@ -544,17 +544,25 @@ AP_DECLARE(apr_status_t) ap_pass_brigade
  */
 AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
                                               apr_bucket_brigade *bb,
-                                              const char *errmsg)
+                                              const char *fmt,
+                                              ...)
 {
     apr_status_t rv;
-    if (!errmsg)
-        errmsg = "ap_pass_brigade returned";
 
     rv = ap_pass_brigade(r->output_filters, bb);
     if (rv != APR_SUCCESS) {
         if (rv != AP_FILTER_ERROR) {
-            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
-                          "%s %d", errmsg, rv);
+            if (!fmt)
+                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+                              "ap_pass_brigade returned %d", rv);
+            else {
+                va_list ap;
+                const char *res;
+                va_start(ap, fmt);
+                res = apr_pvsprintf(r->pool, fmt, ap);
+                va_end(ap);
+                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, res, NULL);
+            }
             return HTTP_INTERNAL_SERVER_ERROR;
         }
         return AP_FILTER_ERROR;



Mime
View raw message