changeset 1799:0b5b94805d26

optimization
author Igor Sysoev <igor@sysoev.ru>
date Thu, 27 Dec 2007 20:32:43 +0000
parents 0379d1fc8701
children 3e1c695258d3
files src/http/modules/ngx_http_flv_module.c src/http/modules/ngx_http_gzip_static_module.c src/http/modules/ngx_http_index_module.c src/http/modules/ngx_http_static_module.c src/http/modules/perl/nginx.xs src/http/ngx_http_script.c
diffstat 6 files changed, 17 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_flv_module.c
+++ b/src/http/modules/ngx_http_flv_module.c
@@ -111,10 +111,9 @@ ngx_http_flv_handler(ngx_http_request_t 
     of.errors = clcf->open_file_cache_errors;
     of.events = clcf->open_file_cache_events;
 
-    rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
-
-    if (rc == NGX_ERROR) {
-
+    if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
+        != NGX_OK)
+    {
         switch (of.err) {
 
         case 0:
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -125,10 +125,9 @@ ngx_http_gzip_static_handler(ngx_http_re
     of.errors = clcf->open_file_cache_errors;
     of.events = clcf->open_file_cache_events;
 
-    rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
-
-    if (rc == NGX_ERROR) {
-
+    if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
+        != NGX_OK)
+    {
         switch (of.err) {
 
         case 0:
@@ -143,20 +142,18 @@ ngx_http_gzip_static_handler(ngx_http_re
         case NGX_EACCES:
 
             level = NGX_LOG_ERR;
-            rc = NGX_DECLINED;
             break;
 
         default:
 
             level = NGX_LOG_CRIT;
-            rc = NGX_DECLINED;
             break;
         }
 
         ngx_log_error(level, log, of.err,
                       ngx_open_file_n " \"%s\" failed", path.data);
 
-        return rc;
+        return NGX_DECLINED;
     }
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -214,10 +214,9 @@ ngx_http_index_handler(ngx_http_request_
         of.errors = clcf->open_file_cache_errors;
         of.events = clcf->open_file_cache_events;
 
-        rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
-
-        if (rc == NGX_ERROR) {
-
+        if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
+            != NGX_OK)
+        {
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, of.err,
                            ngx_open_file_n " \"%s\" failed", path.data);
 
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -102,10 +102,9 @@ ngx_http_static_handler(ngx_http_request
     of.errors = clcf->open_file_cache_errors;
     of.events = clcf->open_file_cache_events;
 
-    rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
-
-    if (rc == NGX_ERROR) {
-
+    if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
+        != NGX_OK)
+    {
         switch (of.err) {
 
         case 0:
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -613,7 +613,6 @@ sendfile(r, filename, offset = -1, bytes
     char                      *filename;
     int                        offset;
     size_t                     bytes;
-    ngx_int_t                  rc;
     ngx_str_t                  path;
     ngx_buf_t                 *b;
     ngx_open_file_info_t       of;
@@ -657,10 +656,9 @@ sendfile(r, filename, offset = -1, bytes
 
     (void) ngx_cpystrn(path.data, filename, path.len + 1);
 
-    rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
-
-    if (rc == NGX_ERROR) {
-
+    if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
+        != NGX_OK)
+    {
         if (of.err == 0) {
             XSRETURN_EMPTY;
         }
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -982,7 +982,7 @@ ngx_http_script_file_code(ngx_http_scrip
     of.events = clcf->open_file_cache_events;
 
     if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
-        == NGX_ERROR)
+        != NGX_OK)
     {
         if (of.err != NGX_ENOENT && of.err != NGX_ENOTDIR) {
             ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,