]> granicus.if.org Git - apache/commitdiff
Use varargs...
authorJim Jagielski <jim@apache.org>
Thu, 24 Nov 2011 15:53:16 +0000 (15:53 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 24 Nov 2011 15:53:16 +0000 (15:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1205894 13f79535-47bb-0310-9956-ffa450edef68

include/util_filter.h
modules/cache/mod_cache.c
server/util_filter.c

index 4b4236529fe15cd08af1c90ab22d1be7a513fc52..cc2a0f76e3ccb488d590f7e9ff5498a0983fa472 100644 (file)
@@ -322,8 +322,8 @@ AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *filter,
  *         ::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_filter_t *filter,
  */
 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_fputstrs(ap_filter_t *f,
  * @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,
index 6b4e13e8a64c5d69ae4bfb2f54b582ff2b3bd99f..b95ded506a976b71440ec84250bf3bce606eb032 100644 (file)
@@ -294,9 +294,8 @@ static int cache_quick_handler(request_rec *r, int lookup)
     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);
 }
 
 /*
index fd07145dbbcc605e740a392b7a17f1a7948e0fae..74dfefba1035dfc45b622d7b32938d2f11a0eceb 100644 (file)
@@ -544,17 +544,25 @@ AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *next,
  */
 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;