summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nxt_js.c18
-rw-r--r--src/nxt_script.c10
2 files changed, 8 insertions, 20 deletions
diff --git a/src/nxt_js.c b/src/nxt_js.c
index 6885afb7..1f9a3ceb 100644
--- a/src/nxt_js.c
+++ b/src/nxt_js.c
@@ -69,14 +69,6 @@ nxt_js_module_loader(njs_vm_t *vm, njs_external_ptr_t external, njs_str_t *name)
}
-static njs_vm_ops_t nxt_js_ops = {
- NULL,
- NULL,
- nxt_js_module_loader,
- NULL,
-};
-
-
njs_int_t nxt_js_proto_id;
@@ -127,6 +119,7 @@ nxt_js_vm_create(nxt_js_conf_t *jcf)
{
u_char *p;
size_t size;
+ njs_vm_t *vm;
nxt_uint_t i;
njs_vm_opt_t opts;
nxt_js_module_t *module, *mod;
@@ -146,7 +139,6 @@ nxt_js_vm_create(nxt_js_conf_t *jcf)
goto done;
}
- opts.ops = &nxt_js_ops;
opts.external = jcf;
size = 0;
@@ -203,7 +195,13 @@ nxt_js_vm_create(nxt_js_conf_t *jcf)
done:
- return njs_vm_create(&opts);
+ vm = njs_vm_create(&opts);
+
+ if (nxt_fast_path(vm != NULL)) {
+ njs_vm_set_module_loader(vm, nxt_js_module_loader, jcf);
+ }
+
+ return vm;
}
diff --git a/src/nxt_script.c b/src/nxt_script.c
index 70045a22..05d9561d 100644
--- a/src/nxt_script.c
+++ b/src/nxt_script.c
@@ -37,14 +37,6 @@ static void nxt_script_buf_completion(nxt_task_t *task, void *obj, void *data);
static nxt_lvlhsh_t nxt_script_info;
-static njs_vm_ops_t nxt_js_ops = {
- NULL,
- NULL,
- nxt_js_module_loader,
- NULL,
-};
-
-
nxt_script_t *
nxt_script_new(nxt_task_t *task, nxt_str_t *name, u_char *data, size_t size,
u_char *error)
@@ -63,8 +55,6 @@ nxt_script_new(nxt_task_t *task, nxt_str_t *name, u_char *data, size_t size,
opts.file.start = (u_char *) "default";
opts.file.length = 7;
- opts.ops = &nxt_js_ops;
-
vm = njs_vm_create(&opts);
if (nxt_slow_path(vm == NULL)) {
return NULL;