[njs] Initialize njs_vm_opt_t structs to 0 to simplify options adding.
Dmitry Volyntsev
xeioex at nginx.com
Mon Jul 17 13:06:47 UTC 2017
details: http://hg.nginx.org/njs/rev/182d765687ee
branches:
changeset: 387:182d765687ee
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Mon Jul 17 15:29:02 2017 +0300
description:
Initialize njs_vm_opt_t structs to 0 to simplify options adding.
diffstat:
nginx/ngx_http_js_module.c | 3 ++-
nginx/ngx_stream_js_module.c | 3 ++-
njs/test/njs_benchmark.c | 4 ++--
njs/test/njs_unit_test.c | 3 ++-
4 files changed, 8 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r bef6842774f6 -r 182d765687ee nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c Mon Jul 17 14:46:35 2017 +0300
+++ b/nginx/ngx_http_js_module.c Mon Jul 17 15:29:02 2017 +0300
@@ -1319,8 +1319,9 @@ ngx_http_js_include(ngx_conf_t *cf, ngx_
return NGX_CONF_ERROR;
}
+ ngx_memzero(&options, sizeof(njs_vm_opt_t));
+
options.mcp = mcp;
- options.shared = NULL;
options.externals = &externals;
jlcf->vm = njs_vm_create(&options);
diff -r bef6842774f6 -r 182d765687ee nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c Mon Jul 17 14:46:35 2017 +0300
+++ b/nginx/ngx_stream_js_module.c Mon Jul 17 15:29:02 2017 +0300
@@ -1029,8 +1029,9 @@ ngx_stream_js_include(ngx_conf_t *cf, ng
return NGX_CONF_ERROR;
}
+ ngx_memzero(&options, sizeof(njs_vm_opt_t));
+
options.mcp = mcp;
- options.shared = NULL;
options.externals = &externals;
jscf->vm = njs_vm_create(&options);
diff -r bef6842774f6 -r 182d765687ee njs/test/njs_benchmark.c
--- a/njs/test/njs_benchmark.c Mon Jul 17 14:46:35 2017 +0300
+++ b/njs/test/njs_benchmark.c Mon Jul 17 15:29:02 2017 +0300
@@ -88,9 +88,9 @@ njs_unit_test_benchmark(nxt_str_t *scrip
return NXT_ERROR;
}
+ memset(&options, 0, sizeof(njs_vm_opt_t));
+
options.mcp = mcp;
- options.shared = NULL;
- options.externals = NULL;
vm = njs_vm_create(&options);
if (vm == NULL) {
diff -r bef6842774f6 -r 182d765687ee njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Mon Jul 17 14:46:35 2017 +0300
+++ b/njs/test/njs_unit_test.c Mon Jul 17 15:29:02 2017 +0300
@@ -8161,8 +8161,9 @@ njs_unit_test(nxt_bool_t disassemble)
(int) njs_test[i].script.length, njs_test[i].script.start);
fflush(stdout);
+ memset(&options, 0, sizeof(njs_vm_opt_t));
+
options.mcp = mcp;
- options.shared = NULL;
options.externals = &externals;
vm = njs_vm_create(&options);
More information about the nginx-devel
mailing list