From: Dmitry Volyntsev Date: Tue, 11 Jun 2024 06:06:26 +0000 (-0700) Subject: Modules: removed extra copying in shared dictionary. X-Git-Tag: 0.8.5~2 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=558de1e14d9c9a6542bc0512b9fff51167ef6f3a;p=njs.git Modules: removed extra copying in shared dictionary. After 5730d5f pool copy is not needed because njs_vm_value_string_create() always create a copy. --- diff --git a/nginx/ngx_js_shared_dict.c b/nginx/ngx_js_shared_dict.c index 330bd9bc..19f6f4bd 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; }