diff src/os/unix/ngx_darwin_sendfile_chain.c @ 5916:e044893b4587

Merged conditions in the ngx_*_sendfile_chain() functions. No functional changes.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 13 Aug 2014 15:11:45 +0400
parents ac3f78219f85
children 2c64b69daec5
line wrap: on
line diff
--- a/src/os/unix/ngx_darwin_sendfile_chain.c
+++ b/src/os/unix/ngx_darwin_sendfile_chain.c
@@ -75,8 +75,6 @@ ngx_darwin_sendfile_chain(ngx_connection
     trailer.nalloc = NGX_IOVS_PREALLOCATE;
 
     for ( ;; ) {
-        file = NULL;
-        file_size = 0;
         eintr = 0;
         prev_send = send;
 
@@ -98,22 +96,21 @@ ngx_darwin_sendfile_chain(ngx_connection
             file_size = ngx_chain_coalesce_file(&cl, limit - send);
 
             send += file_size;
-        }
 
-        if (file && header.count == 0) {
+            if (header.count == 0) {
 
-            /* create the trailer iovec and coalesce the neighbouring bufs */
-
-            cl = ngx_output_chain_to_iovec(&trailer, cl, limit - send, c->log);
+                /*
+                 * create the trailer iovec and coalesce the neighbouring bufs
+                 */
 
-            if (cl == NGX_CHAIN_ERROR) {
-                return NGX_CHAIN_ERROR;
-            }
+                cl = ngx_output_chain_to_iovec(&trailer, cl, limit - send, c->log);
 
-            send += trailer.size;
-        }
+                if (cl == NGX_CHAIN_ERROR) {
+                    return NGX_CHAIN_ERROR;
+                }
 
-        if (file) {
+                send += trailer.size;
+            }
 
             /*
              * sendfile() returns EINVAL if sf_hdtr's count is 0,