details: https://hg.nginx.org/njs/rev/95bb22b30a0d branches: changeset: 2357:95bb22b30a0d user: Dmitry Volyntsev <xei...@nginx.com> date: Mon Jun 10 23:06:26 2024 -0700 description: Modules: removed extra copying in shared dictionary.
After 5730d5f pool copy is not needed because njs_vm_value_string_create() always create a copy. diffstat: nginx/ngx_js_shared_dict.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-) diffs (29 lines): diff -r a5da85a3d309 -r 95bb22b30a0d nginx/ngx_js_shared_dict.c --- a/nginx/ngx_js_shared_dict.c Sun Jun 02 09:11:13 2024 +0100 +++ b/nginx/ngx_js_shared_dict.c Mon Jun 10 23:06:26 2024 -0700 @@ -1440,23 +1440,13 @@ ngx_js_dict_copy_value_locked(njs_vm_t * 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; } _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel