Welcome! Log In Create A New Profile

Advanced

[njs] Added njs_vm_value_array_buffer_set().

Dmitry Volyntsev
January 11, 2021 02:56PM
details: https://hg.nginx.org/njs/rev/59ab52c9700b
branches:
changeset: 1588:59ab52c9700b
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Mon Jan 11 19:53:08 2021 +0000
description:
Added njs_vm_value_array_buffer_set().

diffstat:

src/njs.h | 3 +++
src/njs_vm.c | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)

diffs (43 lines):

diff -r d7ef83814374 -r 59ab52c9700b src/njs.h
--- a/src/njs.h Mon Jan 11 19:53:05 2021 +0000
+++ b/src/njs.h Mon Jan 11 19:53:08 2021 +0000
@@ -331,6 +331,9 @@ NJS_EXPORT u_char *njs_vm_value_string_a
NJS_EXPORT njs_int_t njs_vm_value_string_copy(njs_vm_t *vm, njs_str_t *retval,
njs_value_t *value, uintptr_t *next);

+NJS_EXPORT njs_int_t njs_vm_value_array_buffer_set(njs_vm_t *vm,
+ njs_value_t *value, const u_char *start, uint32_t size);
+
/*
* Sets a Buffer value.
* start data is not copied and should not be freed.
diff -r d7ef83814374 -r 59ab52c9700b src/njs_vm.c
--- a/src/njs_vm.c Mon Jan 11 19:53:05 2021 +0000
+++ b/src/njs_vm.c Mon Jan 11 19:53:08 2021 +0000
@@ -733,6 +733,26 @@ njs_vm_value_string_set(njs_vm_t *vm, nj


njs_int_t
+njs_vm_value_array_buffer_set(njs_vm_t *vm, njs_value_t *value,
+ const u_char *start, uint32_t size)
+{
+ njs_array_buffer_t *array;
+
+ array = njs_array_buffer_alloc(vm, 0, 0);
+ if (njs_slow_path(array == NULL)) {
+ return NJS_ERROR;
+ }
+
+ array->u.data = (u_char *) start;
+ array->size = size;
+
+ njs_set_array_buffer(value, array);
+
+ return NJS_OK;
+}
+
+
+njs_int_t
njs_vm_value_buffer_set(njs_vm_t *vm, njs_value_t *value, const u_char *start,
uint32_t size)
{
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Added njs_vm_value_array_buffer_set().

Dmitry Volyntsev 31 January 11, 2021 02:56PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready