[njs] Introduced njs_vm_opt_init().
Dmitry Volyntsev
xeioex at nginx.com
Sun Apr 12 12:39:39 UTC 2020
details: https://hg.nginx.org/njs/rev/089a13ecbe83
branches:
changeset: 1369:089a13ecbe83
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Sun Apr 12 10:01:40 2020 +0000
description:
Introduced njs_vm_opt_init().
diffstat:
nginx/ngx_http_js_module.c | 2 +-
nginx/ngx_stream_js_module.c | 2 +-
src/njs.h | 1 +
src/njs_shell.c | 4 ++--
src/njs_vm.c | 7 +++++++
src/test/njs_benchmark.c | 4 ++--
src/test/njs_interactive_test.c | 2 +-
src/test/njs_unit_test.c | 6 +++---
8 files changed, 18 insertions(+), 10 deletions(-)
diffs (136 lines):
diff -r 5f4adb155dcf -r 089a13ecbe83 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c Fri Apr 10 11:15:12 2020 +0000
+++ b/nginx/ngx_http_js_module.c Sun Apr 12 10:01:40 2020 +0000
@@ -2404,7 +2404,7 @@ ngx_http_js_include(ngx_conf_t *cf, ngx_
end = start + size;
- ngx_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
options.backtrace = 1;
options.ops = &ngx_http_js_ops;
diff -r 5f4adb155dcf -r 089a13ecbe83 nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c Fri Apr 10 11:15:12 2020 +0000
+++ b/nginx/ngx_stream_js_module.c Sun Apr 12 10:01:40 2020 +0000
@@ -1412,7 +1412,7 @@ ngx_stream_js_include(ngx_conf_t *cf, ng
end = start + size;
- ngx_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
options.backtrace = 1;
options.ops = &ngx_stream_js_ops;
diff -r 5f4adb155dcf -r 089a13ecbe83 src/njs.h
--- a/src/njs.h Fri Apr 10 11:15:12 2020 +0000
+++ b/src/njs.h Sun Apr 12 10:01:40 2020 +0000
@@ -220,6 +220,7 @@ typedef struct {
} njs_vm_opt_t;
+NJS_EXPORT void njs_vm_opt_init(njs_vm_opt_t *options);
NJS_EXPORT njs_vm_t *njs_vm_create(njs_vm_opt_t *options);
NJS_EXPORT void njs_vm_destroy(njs_vm_t *vm);
diff -r 5f4adb155dcf -r 089a13ecbe83 src/njs_shell.c
--- a/src/njs_shell.c Fri Apr 10 11:15:12 2020 +0000
+++ b/src/njs_shell.c Sun Apr 12 10:01:40 2020 +0000
@@ -230,7 +230,7 @@ main(int argc, char **argv)
njs_mm_denormals(opts.denormals);
- njs_memzero(&vm_options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&vm_options);
if (opts.file == NULL) {
p = getcwd(path, sizeof(path));
@@ -573,7 +573,7 @@ LLVMFuzzerTestOneInput(const uint8_t* da
opts.silent = 1;
- njs_memzero(&vm_options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&vm_options);
vm_options.init = 1;
vm_options.backtrace = 0;
diff -r 5f4adb155dcf -r 089a13ecbe83 src/njs_vm.c
--- a/src/njs_vm.c Fri Apr 10 11:15:12 2020 +0000
+++ b/src/njs_vm.c Sun Apr 12 10:01:40 2020 +0000
@@ -19,6 +19,13 @@ const njs_str_t njs_entry_unknown =
const njs_str_t njs_entry_anonymous = njs_str("anonymous");
+void
+njs_vm_opt_init(njs_vm_opt_t *options)
+{
+ njs_memzero(options, sizeof(njs_vm_opt_t));
+}
+
+
njs_vm_t *
njs_vm_create(njs_vm_opt_t *options)
{
diff -r 5f4adb155dcf -r 089a13ecbe83 src/test/njs_benchmark.c
--- a/src/test/njs_benchmark.c Fri Apr 10 11:15:12 2020 +0000
+++ b/src/test/njs_benchmark.c Sun Apr 12 10:01:40 2020 +0000
@@ -48,7 +48,7 @@ njs_benchmark_test(njs_vm_t *parent, njs
static const njs_value_t usec_key = njs_string("usec");
static const njs_value_t times_key = njs_string("times");
- njs_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
vm = NULL;
nvm = NULL;
@@ -375,7 +375,7 @@ main(int argc, char **argv)
}
}
- njs_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
options.init = 1;
options.argv = argv;
options.argc = argc;
diff -r 5f4adb155dcf -r 089a13ecbe83 src/test/njs_interactive_test.c
--- a/src/test/njs_interactive_test.c Fri Apr 10 11:15:12 2020 +0000
+++ b/src/test/njs_interactive_test.c Sun Apr 12 10:01:40 2020 +0000
@@ -316,7 +316,7 @@ njs_interactive_test(njs_bool_t verbose)
njs_printf("\"%V\"\n", &test->script);
}
- njs_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
options.init = 1;
options.accumulative = 1;
diff -r 5f4adb155dcf -r 089a13ecbe83 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Fri Apr 10 11:15:12 2020 +0000
+++ b/src/test/njs_unit_test.c Sun Apr 12 10:01:40 2020 +0000
@@ -17146,7 +17146,7 @@ njs_unit_test(njs_unit_test_t tests[], s
njs_printf("\"%V\"\n", &tests[i].script);
}
- njs_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
options.module = opts->module;
options.unsafe = opts->unsafe;
@@ -17378,7 +17378,7 @@ njs_vm_json_test(njs_opts_t *opts, njs_s
for (i = 0; i < njs_nitems(tests); i++) {
- memset(&options, 0, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
options.init = 1;
vm = njs_vm_create(&options);
@@ -18007,7 +18007,7 @@ njs_api_test(njs_opts_t *opts, njs_stat_
};
vm = NULL;
- njs_memzero(&options, sizeof(njs_vm_opt_t));
+ njs_vm_opt_init(&options);
prev = *stat;
More information about the nginx-devel
mailing list