[nginx] svn commit: r4834 - trunk/src/http

mdounin at mdounin.ru mdounin at mdounin.ru
Wed Sep 5 15:06:48 UTC 2012


Author: mdounin
Date: 2012-09-05 15:06:47 +0000 (Wed, 05 Sep 2012)
New Revision: 4834
URL: http://trac.nginx.org/nginx/changeset/4834/nginx

Log:
Write filter: replaced unneeded loop with one to free chains.

Noted by Gabor Lekeny.


Modified:
   trunk/src/http/ngx_http_write_filter_module.c

Modified: trunk/src/http/ngx_http_write_filter_module.c
===================================================================
--- trunk/src/http/ngx_http_write_filter_module.c	2012-09-03 12:55:50 UTC (rev 4833)
+++ trunk/src/http/ngx_http_write_filter_module.c	2012-09-05 15:06:47 UTC (rev 4834)
@@ -185,23 +185,19 @@
     }
 
     if (size == 0 && !(c->buffered & NGX_LOWLEVEL_BUFFERED)) {
-        if (last) {
+        if (last || flush) {
+            for (cl = r->out; cl; /* void */) {
+                ln = cl;
+                cl = cl->next;
+                ngx_free_chain(r->pool, ln);
+            }
+
             r->out = NULL;
             c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
 
             return NGX_OK;
         }
 
-        if (flush) {
-            do {
-                r->out = r->out->next;
-            } while (r->out);
-
-            c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
-
-            return NGX_OK;
-        }
-
         ngx_log_error(NGX_LOG_ALERT, c->log, 0,
                       "the http output chain is empty");
 



More information about the nginx-devel mailing list