[nginx] SPDY: refactored loop in ngx_http_spdy_body_filter().

Valentin Bartenev vbart at nginx.com
Thu Dec 26 13:05:24 UTC 2013


details:   http://hg.nginx.org/nginx/rev/27f9d5f68c1c
branches:  
changeset: 5494:27f9d5f68c1c
user:      Valentin Bartenev <vbart at nginx.com>
date:      Thu Dec 26 17:03:16 2013 +0400
description:
SPDY: refactored loop in ngx_http_spdy_body_filter().

No functional changes.

diffstat:

 src/http/ngx_http_spdy_filter_module.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r 916cb6d28f6a -r 27f9d5f68c1c src/http/ngx_http_spdy_filter_module.c
--- a/src/http/ngx_http_spdy_filter_module.c	Thu Dec 26 17:03:16 2013 +0400
+++ b/src/http/ngx_http_spdy_filter_module.c	Thu Dec 26 17:03:16 2013 +0400
@@ -618,7 +618,7 @@ ngx_http_spdy_body_filter(ngx_http_reque
 {
     off_t                       size;
     ngx_buf_t                  *b;
-    ngx_chain_t                *cl, *ll, *out, **ln;
+    ngx_chain_t                *cl, *out, **ln;
     ngx_http_spdy_stream_t     *stream;
     ngx_http_spdy_out_frame_t  *frame;
 
@@ -644,10 +644,9 @@ ngx_http_spdy_body_filter(ngx_http_reque
 
     size = 0;
     ln = &out;
-    ll = in;
 
-    for ( ;; ) {
-        b = ll->buf;
+    do {
+        b = in->buf;
 #if 1
         if (ngx_buf_size(b) == 0 && !ngx_buf_special(b)) {
             ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
@@ -678,12 +677,9 @@ ngx_http_spdy_body_filter(ngx_http_reque
         *ln = cl;
         ln = &cl->next;
 
-        if (ll->next == NULL) {
-            break;
-        }
+        in = in->next;
 
-        ll = ll->next;
-    }
+    } while (in);
 
     if (size > NGX_SPDY_MAX_FRAME_SIZE) {
         ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,



More information about the nginx-devel mailing list