[nginx] Script: removed unneeded full name length code.

Maxim Dounin mdounin at mdounin.ru
Tue May 26 01:00:23 UTC 2026


details:   http://freenginx.org/hg/nginx/rev/9d4342eb421e
branches:  
changeset: 9532:9d4342eb421e
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue May 26 03:20:26 2026 +0300
description:
Script: removed unneeded full name length code.

Allocating additional buffer space for prefix is not needed, since
relative paths are expanded using the ngx_get_full_name() function,
which does an allocation itself when needed.

diffstat:

 src/http/ngx_http_script.c     |  26 --------------------------
 src/stream/ngx_stream_script.c |  27 ---------------------------
 2 files changed, 0 insertions(+), 53 deletions(-)

diffs (101 lines):

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
@@ -23,7 +23,6 @@ static ngx_int_t ngx_http_script_add_cap
 #endif
 static ngx_int_t
     ngx_http_script_add_full_name_code(ngx_http_script_compile_t *sc);
-static size_t ngx_http_script_full_name_len_code(ngx_http_script_engine_t *e);
 static void ngx_http_script_full_name_code(ngx_http_script_engine_t *e);
 
 
@@ -1395,17 +1394,6 @@ ngx_http_script_add_full_name_code(ngx_h
 {
     ngx_http_script_full_name_code_t  *code;
 
-    code = ngx_http_script_add_code(*sc->lengths,
-                                    sizeof(ngx_http_script_full_name_code_t),
-                                    NULL);
-    if (code == NULL) {
-        return NGX_ERROR;
-    }
-
-    code->code = (ngx_http_script_code_pt) (uintptr_t)
-                                            ngx_http_script_full_name_len_code;
-    code->conf_prefix = sc->conf_prefix;
-
     code = ngx_http_script_add_code(*sc->values,
                                     sizeof(ngx_http_script_full_name_code_t),
                                     &sc->main);
@@ -1420,20 +1408,6 @@ ngx_http_script_add_full_name_code(ngx_h
 }
 
 
-static size_t
-ngx_http_script_full_name_len_code(ngx_http_script_engine_t *e)
-{
-    ngx_http_script_full_name_code_t  *code;
-
-    code = (ngx_http_script_full_name_code_t *) e->ip;
-
-    e->ip += sizeof(ngx_http_script_full_name_code_t);
-
-    return code->conf_prefix ? ngx_cycle->conf_prefix.len:
-                               ngx_cycle->prefix.len;
-}
-
-
 static void
 ngx_http_script_full_name_code(ngx_http_script_engine_t *e)
 {
diff --git a/src/stream/ngx_stream_script.c b/src/stream/ngx_stream_script.c
--- a/src/stream/ngx_stream_script.c
+++ b/src/stream/ngx_stream_script.c
@@ -23,8 +23,6 @@ static ngx_int_t ngx_stream_script_add_c
 #endif
 static ngx_int_t ngx_stream_script_add_full_name_code(
     ngx_stream_script_compile_t *sc);
-static size_t ngx_stream_script_full_name_len_code(
-    ngx_stream_script_engine_t *e);
 static void ngx_stream_script_full_name_code(ngx_stream_script_engine_t *e);
 
 
@@ -952,17 +950,6 @@ ngx_stream_script_add_full_name_code(ngx
 {
     ngx_stream_script_full_name_code_t  *code;
 
-    code = ngx_stream_script_add_code(*sc->lengths,
-                                    sizeof(ngx_stream_script_full_name_code_t),
-                                    NULL);
-    if (code == NULL) {
-        return NGX_ERROR;
-    }
-
-    code->code = (ngx_stream_script_code_pt) (uintptr_t)
-                                          ngx_stream_script_full_name_len_code;
-    code->conf_prefix = sc->conf_prefix;
-
     code = ngx_stream_script_add_code(*sc->values,
                         sizeof(ngx_stream_script_full_name_code_t), &sc->main);
     if (code == NULL) {
@@ -976,20 +963,6 @@ ngx_stream_script_add_full_name_code(ngx
 }
 
 
-static size_t
-ngx_stream_script_full_name_len_code(ngx_stream_script_engine_t *e)
-{
-    ngx_stream_script_full_name_code_t  *code;
-
-    code = (ngx_stream_script_full_name_code_t *) e->ip;
-
-    e->ip += sizeof(ngx_stream_script_full_name_code_t);
-
-    return code->conf_prefix ? ngx_cycle->conf_prefix.len:
-                               ngx_cycle->prefix.len;
-}
-
-
 static void
 ngx_stream_script_full_name_code(ngx_stream_script_engine_t *e)
 {


More information about the nginx-devel mailing list