diff src/event/ngx_event_pipe.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents da8c190bdaba
children 3050baa54a26
line wrap: on
line diff
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -165,13 +165,15 @@ static ngx_int_t ngx_event_pipe_read_ups
 
                 /* allocate a new buf if it's still allowed */
 
-                if (!(b = ngx_create_temp_buf(p->pool, p->bufs.size))) {
+                b = ngx_create_temp_buf(p->pool, p->bufs.size);
+                if (b == NULL) {
                     return NGX_ABORT;
                 }
 
                 p->allocated++;
 
-                if (!(chain = ngx_alloc_chain_link(p->pool))) {
+                chain = ngx_alloc_chain_link(p->pool);
+                if (chain == NULL) {
                     return NGX_ABORT;
                 }
 
@@ -495,7 +497,13 @@ static ngx_int_t ngx_event_pipe_write_to
             }
 
             cl->next = NULL;
-            ngx_chain_add_link(out, ll, cl);
+
+            if (out) {
+                *ll = cl;
+            } else {
+                out = cl;
+            }
+            ll = &cl->next;
         }
 
         ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
@@ -635,11 +643,17 @@ static ngx_int_t ngx_event_pipe_write_ch
         b->in_file = 1;
         b->temp_file = 1;
 
-        ngx_chain_add_link(p->out, p->last_out, cl);
+        if (p->out) {
+            *p->last_out = cl;
+        } else {
+            p->out = cl;
+        }
+        p->last_out = &cl->next;
 
         if (b->last_shadow) {
 
-            if (!(tl = ngx_alloc_chain_link(p->pool))) {
+            tl = ngx_alloc_chain_link(p->pool);
+            if (tl == NULL) {
                 return NGX_ABORT;
             }
 
@@ -676,7 +690,8 @@ ngx_int_t ngx_event_pipe_copy_input_filt
         p->free = p->free->next;
 
     } else {
-        if (!(b = ngx_alloc_buf(p->pool))) {
+        b = ngx_alloc_buf(p->pool);
+        if (b == NULL) {
             return NGX_ERROR;
         }
     }
@@ -688,7 +703,8 @@ ngx_int_t ngx_event_pipe_copy_input_filt
     b->recycled = 1;
     buf->shadow = b;
 
-    if (!(cl = ngx_alloc_chain_link(p->pool))) {
+    cl = ngx_alloc_chain_link(p->pool);
+    if (cl == NULL) {
         return NGX_ERROR;
     }
 
@@ -697,7 +713,12 @@ ngx_int_t ngx_event_pipe_copy_input_filt
 
     ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "input buf #%d", b->num);
 
-    ngx_chain_add_link(p->in, p->last_in, cl);
+    if (p->in) {
+        *p->last_in = cl;
+    } else {
+        p->in = cl;
+    }
+    p->last_in = &cl->next;
 
     return NGX_OK;
 }
@@ -766,7 +787,8 @@ ngx_int_t ngx_event_pipe_add_free_buf(ng
 {
     ngx_chain_t  *cl;
 
-    if (!(cl = ngx_alloc_chain_link(p->pool))) {
+    cl = ngx_alloc_chain_link(p->pool);
+    if (cl == NULL) {
         return NGX_ERROR;
     }