[njs] Removed unused njs_vm_export_functions().
Dmitry Volyntsev
xeioex at nginx.com
Thu Jul 6 16:07:08 UTC 2017
details: http://hg.nginx.org/njs/rev/f8f7540383f2
branches:
changeset: 382:f8f7540383f2
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Wed Jun 28 15:31:36 2017 +0300
description:
Removed unused njs_vm_export_functions().
diffstat:
nginx/ngx_http_js_module.c | 4 +-
nginx/ngx_stream_js_module.c | 4 +-
njs/njs_variable.c | 56 --------------------------------------------
njs/njs_variable.h | 2 -
njs/njscript.c | 7 +----
njs/njscript.h | 3 +-
njs/test/njs_unit_test.c | 9 +++---
7 files changed, 10 insertions(+), 75 deletions(-)
diffs (197 lines):
diff -r 63d7430291f2 -r f8f7540383f2 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c Tue Jun 27 17:03:16 2017 +0300
+++ b/nginx/ngx_http_js_module.c Wed Jun 28 15:31:36 2017 +0300
@@ -1230,7 +1230,7 @@ ngx_http_js_include(ngx_conf_t *cf, ngx_
ngx_fd_t fd;
ngx_str_t *value, file;
nxt_int_t rc;
- nxt_str_t text, ext, *export;
+ nxt_str_t text, ext;
nxt_lvlhsh_t externals;
ngx_file_info_t fi;
njs_vm_shared_t *shared;
@@ -1327,7 +1327,7 @@ ngx_http_js_include(ngx_conf_t *cf, ngx_
return NGX_CONF_ERROR;
}
- rc = njs_vm_compile(jlcf->vm, &start, end, &export);
+ rc = njs_vm_compile(jlcf->vm, &start, end);
if (rc != NJS_OK) {
njs_vm_exception(jlcf->vm, &text);
diff -r 63d7430291f2 -r f8f7540383f2 nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c Tue Jun 27 17:03:16 2017 +0300
+++ b/nginx/ngx_stream_js_module.c Wed Jun 28 15:31:36 2017 +0300
@@ -940,7 +940,7 @@ ngx_stream_js_include(ngx_conf_t *cf, ng
ngx_fd_t fd;
ngx_str_t *value, file;
nxt_int_t rc;
- nxt_str_t text, ext, *export;
+ nxt_str_t text, ext;
nxt_lvlhsh_t externals;
ngx_file_info_t fi;
njs_vm_shared_t *shared;
@@ -1037,7 +1037,7 @@ ngx_stream_js_include(ngx_conf_t *cf, ng
return NGX_CONF_ERROR;
}
- rc = njs_vm_compile(jscf->vm, &start, end, &export);
+ rc = njs_vm_compile(jscf->vm, &start, end);
if (rc != NJS_OK) {
njs_vm_exception(jscf->vm, &text);
diff -r 63d7430291f2 -r f8f7540383f2 njs/njs_variable.c
--- a/njs/njs_variable.c Tue Jun 27 17:03:16 2017 +0300
+++ b/njs/njs_variable.c Wed Jun 28 15:31:36 2017 +0300
@@ -489,62 +489,6 @@ njs_name_copy(njs_vm_t *vm, nxt_str_t *d
}
-nxt_str_t *
-njs_vm_export_functions(njs_vm_t *vm)
-{
- size_t n;
- nxt_str_t *ex, *export;
- njs_value_t *value;
- njs_variable_t *var;
- nxt_lvlhsh_each_t lhe;
-
- n = 1;
-
- nxt_lvlhsh_each_init(&lhe, &njs_variables_hash_proto);
-
- for ( ;; ) {
- var = nxt_lvlhsh_each(&vm->variables_hash, &lhe);
- if (var == NULL) {
- break;
- }
-
- value = njs_global_variable_value(vm, var);
-
- if (njs_is_function(value) && !value->data.u.function->native) {
- n++;
- }
- }
-
- export = nxt_mem_cache_alloc(vm->mem_cache_pool, n * sizeof(nxt_str_t));
- if (nxt_slow_path(export == NULL)) {
- return NULL;
- }
-
- nxt_lvlhsh_each_init(&lhe, &njs_variables_hash_proto);
-
- ex = export;
-
- for ( ;; ) {
- var = nxt_lvlhsh_each(&vm->variables_hash, &lhe);
- if (var == NULL) {
- break;
- }
-
- value = njs_global_variable_value(vm, var);
-
- if (njs_is_function(value) && !value->data.u.function->native) {
- *ex = var->name;
- ex++;
- }
- }
-
- ex->length = 0;
- ex->start = NULL;
-
- return export;
-}
-
-
njs_function_t *
njs_vm_function(njs_vm_t *vm, nxt_str_t *name)
{
diff -r 63d7430291f2 -r f8f7540383f2 njs/njs_variable.h
--- a/njs/njs_variable.h Tue Jun 27 17:03:16 2017 +0300
+++ b/njs/njs_variable.h Wed Jun 28 15:31:36 2017 +0300
@@ -42,8 +42,6 @@ njs_ret_t njs_variables_scope_reference(
njs_parser_scope_t *scope);
njs_ret_t njs_name_copy(njs_vm_t *vm, nxt_str_t *dst, nxt_str_t *src);
-nxt_str_t *njs_vm_export_functions(njs_vm_t *vm);
-
extern const nxt_lvlhsh_proto_t njs_variables_hash_proto;
diff -r 63d7430291f2 -r f8f7540383f2 njs/njscript.c
--- a/njs/njscript.c Tue Jun 27 17:03:16 2017 +0300
+++ b/njs/njscript.c Wed Jun 28 15:31:36 2017 +0300
@@ -184,7 +184,7 @@ njs_vm_destroy(njs_vm_t *vm)
nxt_int_t
-njs_vm_compile(njs_vm_t *vm, u_char **start, u_char *end, nxt_str_t **export)
+njs_vm_compile(njs_vm_t *vm, u_char **start, u_char *end)
{
nxt_int_t ret;
njs_lexer_t *lexer;
@@ -237,11 +237,6 @@ njs_vm_compile(njs_vm_t *vm, u_char **st
vm->parser = NULL;
- *export = njs_vm_export_functions(vm);
- if (nxt_slow_path(*export == NULL)) {
- return NJS_ERROR;
- }
-
return NJS_OK;
}
diff -r 63d7430291f2 -r f8f7540383f2 njs/njscript.h
--- a/njs/njscript.h Tue Jun 27 17:03:16 2017 +0300
+++ b/njs/njscript.h Wed Jun 28 15:31:36 2017 +0300
@@ -83,8 +83,7 @@ NXT_EXPORT njs_vm_t *njs_vm_create(nxt_m
njs_vm_shared_t **shared, nxt_lvlhsh_t *externals);
NXT_EXPORT void njs_vm_destroy(njs_vm_t *vm);
-NXT_EXPORT nxt_int_t njs_vm_compile(njs_vm_t *vm, u_char **start, u_char *end,
- nxt_str_t **export);
+NXT_EXPORT nxt_int_t njs_vm_compile(njs_vm_t *vm, u_char **start, u_char *end);
NXT_EXPORT njs_vm_t *njs_vm_clone(njs_vm_t *vm, nxt_mem_cache_pool_t *mcp,
void **external);
NXT_EXPORT nxt_int_t njs_vm_call(njs_vm_t *vm, njs_function_t *function,
diff -r 63d7430291f2 -r f8f7540383f2 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Tue Jun 27 17:03:16 2017 +0300
+++ b/njs/test/njs_unit_test.c Wed Jun 28 15:31:36 2017 +0300
@@ -8118,7 +8118,7 @@ njs_unit_test(nxt_bool_t disassemble)
u_char *start;
njs_vm_t *vm, *nvm;
nxt_int_t ret;
- nxt_str_t s, *export;
+ nxt_str_t s;
nxt_uint_t i;
nxt_bool_t success;
nxt_lvlhsh_t externals;
@@ -8164,8 +8164,7 @@ njs_unit_test(nxt_bool_t disassemble)
start = njs_test[i].script.start;
- ret = njs_vm_compile(vm, &start, start + njs_test[i].script.length,
- &export);
+ ret = njs_vm_compile(vm, &start, start + njs_test[i].script.length);
if (ret == NXT_OK) {
if (disassemble) {
@@ -8232,7 +8231,7 @@ njs_unit_test_benchmark(nxt_str_t *scrip
njs_vm_t *vm, *nvm;
uint64_t us;
nxt_int_t ret;
- nxt_str_t s, *export;
+ nxt_str_t s;
nxt_uint_t i;
nxt_bool_t success;
nxt_lvlhsh_t externals;
@@ -8266,7 +8265,7 @@ njs_unit_test_benchmark(nxt_str_t *scrip
start = script->start;
- ret = njs_vm_compile(vm, &start, start + script->length, &export);
+ ret = njs_vm_compile(vm, &start, start + script->length);
if (ret != NXT_OK) {
return NXT_ERROR;
}
More information about the nginx-devel
mailing list