[njs] Fixed handling of "init" flag in njs_vm_create().

Dmitry Volyntsev xeioex at nginx.com
Tue Nov 19 16:31:59 UTC 2019


details:   https://hg.nginx.org/njs/rev/452ce96df2e3
branches:  
changeset: 1245:452ce96df2e3
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Nov 19 19:19:53 2019 +0300
description:
Fixed handling of "init" flag in njs_vm_create().

diffstat:

 src/njs_shell.c                 |  2 +-
 src/njs_vm.c                    |  2 +-
 src/test/njs_interactive_test.c |  1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r d4fdf0fc449d -r 452ce96df2e3 src/njs_shell.c
--- a/src/njs_shell.c	Tue Nov 19 17:22:53 2019 +0300
+++ b/src/njs_shell.c	Tue Nov 19 19:19:53 2019 +0300
@@ -243,7 +243,7 @@ main(int argc, char **argv)
     vm_options.file.start = (u_char *) opts.file;
     vm_options.file.length = njs_strlen(opts.file);
 
-    vm_options.init = !opts.interactive;
+    vm_options.init = 1;
     vm_options.accumulative = opts.interactive;
     vm_options.disassemble = opts.disassemble;
     vm_options.backtrace = 1;
diff -r d4fdf0fc449d -r 452ce96df2e3 src/njs_vm.c
--- a/src/njs_vm.c	Tue Nov 19 17:22:53 2019 +0300
+++ b/src/njs_vm.c	Tue Nov 19 19:19:53 2019 +0300
@@ -85,7 +85,7 @@ njs_vm_create(njs_vm_opt_t *options)
         vm->debug = debug;
     }
 
-    if (options->accumulative) {
+    if (options->init) {
         ret = njs_vm_init(vm);
         if (njs_slow_path(ret != NJS_OK)) {
             return NULL;
diff -r d4fdf0fc449d -r 452ce96df2e3 src/test/njs_interactive_test.c
--- a/src/test/njs_interactive_test.c	Tue Nov 19 17:22:53 2019 +0300
+++ b/src/test/njs_interactive_test.c	Tue Nov 19 19:19:53 2019 +0300
@@ -289,6 +289,7 @@ njs_interactive_test(njs_bool_t verbose)
 
         njs_memzero(&options, sizeof(njs_vm_opt_t));
 
+        options.init = 1;
         options.accumulative = 1;
         options.backtrace = 1;
 


More information about the nginx-devel mailing list