httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1736250 - /httpd/httpd/trunk/modules/http2/h2_filter.c
Date Tue, 22 Mar 2016 20:46:19 GMT
Author: ylavic
Date: Tue Mar 22 20:46:19 2016
New Revision: 1736250

URL: http://svn.apache.org/viewvc?rev=1736250&view=rev
Log:
mod_http2: no variadic macro in C89, use equivalent function.

Modified:
    httpd/httpd/trunk/modules/http2/h2_filter.c

Modified: httpd/httpd/trunk/modules/http2/h2_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_filter.c?rev=1736250&r1=1736249&r2=1736250&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_filter.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_filter.c Tue Mar 22 20:46:19 2016
@@ -196,7 +196,18 @@ int h2_filter_h2_status_handler(request_
     return DECLINED;
 }
 
-#define bbout(...)   apr_brigade_printf(bb, NULL, NULL, __VA_ARGS__)
+static apr_status_t bbout(apr_bucket_brigade *bb, const char *fmt, ...)
+{
+    va_list args;
+    apr_status_t rv;
+
+    va_start(args, fmt);
+    rv = apr_brigade_vprintf(bb, NULL, NULL, fmt, args);
+    va_end(args);
+
+    return rv;
+}
+
 static apr_status_t h2_sos_h2_status_buffer(h2_sos *sos, apr_bucket_brigade *bb)
 {
     h2_stream *stream = sos->stream;
@@ -209,21 +220,21 @@ static apr_status_t h2_sos_h2_status_buf
         bb = apr_brigade_create(stream->pool, session->c->bucket_alloc);
     }
     
-    bbout("{\n");
-    bbout("  \"HTTP2\": \"on\",\n");
-    bbout("  \"H2PUSH\": \"%s\",\n", h2_session_push_enabled(session)? "on" : "off");
-    bbout("  \"mod_http2_version\": \"%s\",\n", MOD_HTTP2_VERSION);
-    bbout("  \"session_id\": %ld,\n", (long)session->id);
-    bbout("  \"streams_max\": %d,\n", (int)session->max_stream_count);
-    bbout("  \"this_stream\": %d,\n", stream->id);
-    bbout("  \"streams_open\": %d,\n", (int)h2_ihash_count(session->streams));
-    bbout("  \"max_stream_started\": %d,\n", mplx->max_stream_started);
-    bbout("  \"requests_received\": %d,\n", session->remote.emitted_count);
-    bbout("  \"responses_submitted\": %d,\n", session->responses_submitted);
-    bbout("  \"streams_reset\": %d, \n", session->streams_reset);
-    bbout("  \"pushes_promised\": %d,\n", session->pushes_promised);
-    bbout("  \"pushes_submitted\": %d,\n", session->pushes_submitted);
-    bbout("  \"pushes_reset\": %d,\n", session->pushes_reset);
+    bbout(bb, "{\n");
+    bbout(bb, "  \"HTTP2\": \"on\",\n");
+    bbout(bb, "  \"H2PUSH\": \"%s\",\n", h2_session_push_enabled(session)? "on" : "off");
+    bbout(bb, "  \"mod_http2_version\": \"%s\",\n", MOD_HTTP2_VERSION);
+    bbout(bb, "  \"session_id\": %ld,\n", (long)session->id);
+    bbout(bb, "  \"streams_max\": %d,\n", (int)session->max_stream_count);
+    bbout(bb, "  \"this_stream\": %d,\n", stream->id);
+    bbout(bb, "  \"streams_open\": %d,\n", (int)h2_ihash_count(session->streams));
+    bbout(bb, "  \"max_stream_started\": %d,\n", mplx->max_stream_started);
+    bbout(bb, "  \"requests_received\": %d,\n", session->remote.emitted_count);
+    bbout(bb, "  \"responses_submitted\": %d,\n", session->responses_submitted);
+    bbout(bb, "  \"streams_reset\": %d, \n", session->streams_reset);
+    bbout(bb, "  \"pushes_promised\": %d,\n", session->pushes_promised);
+    bbout(bb, "  \"pushes_submitted\": %d,\n", session->pushes_submitted);
+    bbout(bb, "  \"pushes_reset\": %d,\n", session->pushes_reset);
     
     diary = session->push_diary;
     if (diary) {
@@ -235,7 +246,7 @@ static apr_status_t h2_sos_h2_status_buf
                                           stream->request->authority, &data, &len);
         if (status == APR_SUCCESS) {
             base64_digest = h2_util_base64url_encode(data, len, stream->pool);
-            bbout("  \"cache_digest\": \"%s\",\n", base64_digest);
+            bbout(bb, "  \"cache_digest\": \"%s\",\n", base64_digest);
         }
         
         /* try the reverse for testing purposes */
@@ -245,15 +256,15 @@ static apr_status_t h2_sos_h2_status_buf
                                               stream->request->authority, &data,
&len);
             if (status == APR_SUCCESS) {
                 base64_digest = h2_util_base64url_encode(data, len, stream->pool);
-                bbout("  \"cache_digest^2\": \"%s\",\n", base64_digest);
+                bbout(bb, "  \"cache_digest^2\": \"%s\",\n", base64_digest);
             }
         }
     }
-    bbout("  \"frames_received\": %ld,\n", (long)session->frames_received);
-    bbout("  \"frames_sent\": %ld,\n", (long)session->frames_sent);
-    bbout("  \"bytes_received\": %"APR_UINT64_T_FMT",\n", session->io.bytes_read);
-    bbout("  \"bytes_sent\": %"APR_UINT64_T_FMT"\n", session->io.bytes_written);
-    bbout("}\n");
+    bbout(bb, "  \"frames_received\": %ld,\n", (long)session->frames_received);
+    bbout(bb, "  \"frames_sent\": %ld,\n", (long)session->frames_sent);
+    bbout(bb, "  \"bytes_received\": %"APR_UINT64_T_FMT",\n", session->io.bytes_read);
+    bbout(bb, "  \"bytes_sent\": %"APR_UINT64_T_FMT"\n", session->io.bytes_written);
+    bbout(bb, "}\n");
     
     return sos->prev->buffer(sos->prev, bb);
 }



Mime
View raw message