From 558de1e14d9c9a6542bc0512b9fff51167ef6f3a Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Mon, 10 Jun 2024 23:06:26 -0700 Subject: [PATCH] Modules: removed extra copying in shared dictionary. After 5730d5f pool copy is not needed because njs_vm_value_string_create() always create a copy. --- nginx/ngx_js_shared_dict.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nginx/ngx_js_shared_dict.c b/nginx/ngx_js_shared_dict.c index 330bd9bc9..19f6f4bd4 100644 --- a/nginx/ngx_js_shared_dict.c +++ b/nginx/ngx_js_shared_dict.c @@ -1440,23 +1440,13 @@ ngx_js_dict_copy_value_locked(njs_vm_t *vm, ngx_js_dict_t *dict, ngx_js_dict_node_t *node, njs_value_t *retval) { njs_int_t ret; - njs_str_t string; ngx_uint_t type; - ngx_pool_t *pool; type = dict->type; if (type == NGX_JS_DICT_TYPE_STRING) { - pool = ngx_external_pool(vm, njs_vm_external_ptr(vm)); - - string.length = node->u.value.len; - string.start = ngx_pstrdup(pool, &node->u.value); - if (string.start == NULL) { - return NGX_ERROR; - } - - ret = njs_vm_value_string_create(vm, retval, string.start, - string.length); + ret = njs_vm_value_string_create(vm, retval, node->u.value.data, + node->u.value.len); if (ret != NJS_OK) { return NGX_ERROR; }