Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules: removed extra copying in shared dictionary. #736

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions nginx/ngx_js_shared_dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down