[nginx] Replaced ngx_conf_full_name() with ngx_get_full_name().

Valentin Bartenev vbart at nginx.com
Tue Aug 6 16:01:24 UTC 2013


details:   http://hg.nginx.org/nginx/rev/f1a91825730a
branches:  
changeset: 5317:f1a91825730a
user:      Valentin Bartenev <vbart at nginx.com>
date:      Tue Aug 06 19:58:40 2013 +0400
description:
Replaced ngx_conf_full_name() with ngx_get_full_name().

The ngx_get_full_name() function takes more readable arguments list.

diffstat:

 src/core/nginx.c                               |  10 +++++++---
 src/core/ngx_conf_file.c                       |   4 ++--
 src/core/ngx_file.c                            |   8 ++++++--
 src/event/ngx_event_openssl.c                  |  12 ++++++------
 src/event/ngx_event_openssl_stapling.c         |   2 +-
 src/http/modules/ngx_http_geo_module.c         |   2 +-
 src/http/modules/ngx_http_log_module.c         |   4 +++-
 src/http/modules/ngx_http_xslt_filter_module.c |   2 +-
 src/http/modules/perl/ngx_http_perl_module.c   |   4 +++-
 src/http/ngx_http_core_module.c                |   8 ++++++--
 src/http/ngx_http_file_cache.c                 |   4 +++-
 src/http/ngx_http_script.c                     |   7 ++++++-
 12 files changed, 45 insertions(+), 22 deletions(-)

diffs (257 lines):

diff -r 12dd27b74117 -r f1a91825730a src/core/nginx.c
--- a/src/core/nginx.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/core/nginx.c	Tue Aug 06 19:58:40 2013 +0400
@@ -897,7 +897,9 @@ ngx_process_options(ngx_cycle_t *cycle)
         ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
     }
 
-    if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
+    if (ngx_get_full_name(cycle->pool, &cycle->prefix, &cycle->conf_file)
+        != NGX_OK)
+    {
         return NGX_ERROR;
     }
 
@@ -1013,7 +1015,7 @@ ngx_core_module_init_conf(ngx_cycle_t *c
         ngx_str_set(&ccf->pid, NGX_PID_PATH);
     }
 
-    if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
+    if (ngx_get_full_name(cycle->pool, &cycle->prefix, &ccf->pid) != NGX_OK) {
         return NGX_CONF_ERROR;
     }
 
@@ -1061,7 +1063,9 @@ ngx_core_module_init_conf(ngx_cycle_t *c
         ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH);
     }
 
-    if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
+    if (ngx_get_full_name(cycle->pool, &cycle->prefix, &ccf->lock_file)
+        != NGX_OK)
+    {
         return NGX_CONF_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/core/ngx_conf_file.c
--- a/src/core/ngx_conf_file.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/core/ngx_conf_file.c	Tue Aug 06 19:58:40 2013 +0400
@@ -747,7 +747,7 @@ ngx_conf_include(ngx_conf_t *cf, ngx_com
 
     ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
 
-    if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, &file) != NGX_OK) {
         return NGX_CONF_ERROR;
     }
 
@@ -822,7 +822,7 @@ ngx_conf_open_file(ngx_cycle_t *cycle, n
     if (name->len) {
         full = *name;
 
-        if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) {
+        if (ngx_get_full_name(cycle->pool, &cycle->prefix, &full) != NGX_OK) {
             return NULL;
         }
 
diff -r 12dd27b74117 -r f1a91825730a src/core/ngx_file.c
--- a/src/core/ngx_file.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/core/ngx_file.c	Tue Aug 06 19:58:40 2013 +0400
@@ -355,7 +355,9 @@ ngx_conf_set_path_slot(ngx_conf_t *cf, n
         path->name.len--;
     }
 
-    if (ngx_conf_full_name(cf->cycle, &path->name, 0) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &path->name)
+        != NGX_OK)
+    {
         return NULL;
     }
 
@@ -409,7 +411,9 @@ ngx_conf_merge_path_value(ngx_conf_t *cf
 
     (*path)->name = init->name;
 
-    if (ngx_conf_full_name(cf->cycle, &(*path)->name, 0) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &(*path)->name)
+        != NGX_OK)
+    {
         return NGX_CONF_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/event/ngx_event_openssl.c	Tue Aug 06 19:58:40 2013 +0400
@@ -240,7 +240,7 @@ ngx_ssl_certificate(ngx_conf_t *cf, ngx_
     X509    *x509;
     u_long   n;
 
-    if (ngx_conf_full_name(cf->cycle, cert, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, cert) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -319,7 +319,7 @@ ngx_ssl_certificate(ngx_conf_t *cf, ngx_
 
     BIO_free(bio);
 
-    if (ngx_conf_full_name(cf->cycle, key, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, key) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -350,7 +350,7 @@ ngx_ssl_client_certificate(ngx_conf_t *c
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, cert, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, cert) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -394,7 +394,7 @@ ngx_ssl_trusted_certificate(ngx_conf_t *
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, cert, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, cert) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -421,7 +421,7 @@ ngx_ssl_crl(ngx_conf_t *cf, ngx_ssl_t *s
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, crl, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, crl) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -587,7 +587,7 @@ ngx_ssl_dhparam(ngx_conf_t *cf, ngx_ssl_
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, file, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, file) != NGX_OK) {
         return NGX_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/event/ngx_event_openssl_stapling.c
--- a/src/event/ngx_event_openssl_stapling.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/event/ngx_event_openssl_stapling.c	Tue Aug 06 19:58:40 2013 +0400
@@ -197,7 +197,7 @@ ngx_ssl_stapling_file(ngx_conf_t *cf, ng
 
     staple = SSL_CTX_get_ex_data(ssl->ctx, ngx_ssl_stapling_index);
 
-    if (ngx_conf_full_name(cf->cycle, file, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, file) != NGX_OK) {
         return NGX_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/http/modules/ngx_http_geo_module.c
--- a/src/http/modules/ngx_http_geo_module.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/modules/ngx_http_geo_module.c	Tue Aug 06 19:58:40 2013 +0400
@@ -1327,7 +1327,7 @@ ngx_http_geo_include(ngx_conf_t *cf, ngx
 
     ngx_sprintf(file.data, "%V.bin%Z", name);
 
-    if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, &file) != NGX_OK) {
         return NGX_CONF_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/http/modules/ngx_http_log_module.c
--- a/src/http/modules/ngx_http_log_module.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/modules/ngx_http_log_module.c	Tue Aug 06 19:58:40 2013 +0400
@@ -1134,7 +1134,9 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
         }
 
     } else {
-        if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
+        if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &value[1])
+            != NGX_OK)
+        {
             return NGX_CONF_ERROR;
         }
 
diff -r 12dd27b74117 -r f1a91825730a src/http/modules/ngx_http_xslt_filter_module.c
--- a/src/http/modules/ngx_http_xslt_filter_module.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/modules/ngx_http_xslt_filter_module.c	Tue Aug 06 19:58:40 2013 +0400
@@ -892,7 +892,7 @@ ngx_http_xslt_stylesheet(ngx_conf_t *cf,
 
     ngx_memzero(sheet, sizeof(ngx_http_xslt_sheet_t));
 
-    if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &value[1]) != NGX_OK) {
         return NGX_CONF_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/http/modules/perl/ngx_http_perl_module.c
--- a/src/http/modules/perl/ngx_http_perl_module.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/modules/perl/ngx_http_perl_module.c	Tue Aug 06 19:58:40 2013 +0400
@@ -485,7 +485,9 @@ ngx_http_perl_init_interpreter(ngx_conf_
     if (pmcf->modules != NGX_CONF_UNSET_PTR) {
         m = pmcf->modules->elts;
         for (i = 0; i < pmcf->modules->nelts; i++) {
-            if (ngx_conf_full_name(cf->cycle, &m[i], 0) != NGX_OK) {
+            if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &m[i])
+                != NGX_OK)
+            {
                 return NGX_CONF_ERROR;
             }
         }
diff -r 12dd27b74117 -r f1a91825730a src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/ngx_http_core_module.c	Tue Aug 06 19:58:40 2013 +0400
@@ -3686,7 +3686,9 @@ ngx_http_core_merge_loc_conf(ngx_conf_t 
         if (prev->root.data == NULL) {
             ngx_str_set(&conf->root, "html");
 
-            if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) {
+            if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &conf->root)
+                != NGX_OK)
+            {
                 return NGX_CONF_ERROR;
             }
         }
@@ -4428,7 +4430,9 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_c
     }
 
     if (clcf->root.data[0] != '$') {
-        if (ngx_conf_full_name(cf->cycle, &clcf->root, 0) != NGX_OK) {
+        if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &clcf->root)
+            != NGX_OK)
+        {
             return NGX_CONF_ERROR;
         }
     }
diff -r 12dd27b74117 -r f1a91825730a src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/ngx_http_file_cache.c	Tue Aug 06 19:58:40 2013 +0400
@@ -1626,7 +1626,9 @@ ngx_http_file_cache_set_slot(ngx_conf_t 
         cache->path->name.len--;
     }
 
-    if (ngx_conf_full_name(cf->cycle, &cache->path->name, 0) != NGX_OK) {
+    if (ngx_get_full_name(cf->pool, &cf->cycle->prefix, &cache->path->name)
+        != NGX_OK)
+    {
         return NGX_CONF_ERROR;
     }
 
diff -r 12dd27b74117 -r f1a91825730a src/http/ngx_http_script.c
--- a/src/http/ngx_http_script.c	Tue Aug 06 19:58:40 2013 +0400
+++ b/src/http/ngx_http_script.c	Tue Aug 06 19:58:40 2013 +0400
@@ -131,7 +131,12 @@ ngx_http_compile_complex_value(ngx_http_
     if ((v->len == 0 || v->data[0] != '$')
         && (ccv->conf_prefix || ccv->root_prefix))
     {
-        if (ngx_conf_full_name(ccv->cf->cycle, v, ccv->conf_prefix) != NGX_OK) {
+        if (ngx_get_full_name(ccv->cf->pool,
+                              ccv->conf_prefix ? &ccv->cf->cycle->conf_prefix:
+                                                 &ccv->cf->cycle->prefix,
+                              v)
+            != NGX_OK)
+        {
             return NGX_ERROR;
         }
 



More information about the nginx-devel mailing list