[njs] Introduced njs_vm_global() to get global object.
Dmitry Volyntsev
xeioex at nginx.com
Tue Mar 19 05:56:50 UTC 2024
details: https://hg.nginx.org/njs/rev/00b89201fb71
branches:
changeset: 2297:00b89201fb71
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Thu Mar 14 23:28:03 2024 -0700
description:
Introduced njs_vm_global() to get global object.
diffstat:
src/njs.h | 1 +
src/njs_vm.c | 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diffs (29 lines):
diff -r 8309b884e265 -r 00b89201fb71 src/njs.h
--- a/src/njs.h Tue Mar 05 11:43:49 2024 -0800
+++ b/src/njs.h Thu Mar 14 23:28:03 2024 -0700
@@ -368,6 +368,7 @@ NJS_EXPORT njs_int_t njs_vm_bind(njs_vm_
njs_int_t njs_vm_bind_handler(njs_vm_t *vm, const njs_str_t *var_name,
njs_prop_handler_t handler, uint16_t magic16, uint32_t magic32,
njs_bool_t shared);
+NJS_EXPORT njs_int_t njs_vm_global(njs_vm_t *vm, njs_value_t *retval);
NJS_EXPORT njs_int_t njs_vm_value(njs_vm_t *vm, const njs_str_t *path,
njs_value_t *retval);
NJS_EXPORT njs_function_t *njs_vm_function(njs_vm_t *vm, const njs_str_t *name);
diff -r 8309b884e265 -r 00b89201fb71 src/njs_vm.c
--- a/src/njs_vm.c Tue Mar 05 11:43:49 2024 -0800
+++ b/src/njs_vm.c Thu Mar 14 23:28:03 2024 -0700
@@ -814,6 +814,14 @@ njs_vm_error3(njs_vm_t *vm, unsigned typ
njs_int_t
+njs_vm_global(njs_vm_t *vm, njs_value_t *retval)
+{
+ njs_value_assign(retval, &vm->global_value);
+ return NJS_OK;
+}
+
+
+njs_int_t
njs_vm_value(njs_vm_t *vm, const njs_str_t *path, njs_value_t *retval)
{
u_char *start, *p, *end;
More information about the nginx-devel
mailing list