# HG changeset patch # User Igor Sysoev # Date 1198787563 0 # Node ID 0b5b94805d266d5512be27a46f4b5d9a12b53cee # Parent 0379d1fc8701ac0ea0e54386af291df8b9e4cff3 optimization diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c --- 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: diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c --- 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); diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c --- 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); diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c --- 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: diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs --- 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; } diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c --- 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,