Fix modifying of dict

This commit is contained in:
Gregory Lirent 2023-03-23 19:30:06 +03:00
parent c81b412a82
commit 3e860c26d3

View File

@ -60,8 +60,8 @@ bool libcdsb_dict_update(dict_t* x, vtype_variable key, vtype_variable value, vo
while (!is_null(c)) { while (!is_null(c)) {
if (vtype_compare(key.pointer, key.type, vnode_peek(&c->key, c->key_type), c->key_type) == 0) { if (vtype_compare(key.pointer, key.type, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
if (!callback) callback(libcdsb_variable_build(vnode_peek(&c->key, c->key_type), c->key_type), if (callback) callback(libcdsb_variable_build(vnode_peek(&c->key, c->key_type), c->key_type),
libcdsb_variable_build(vnode_peek(&c->value, c->value_type), c->value_type), dt); libcdsb_variable_build(vnode_peek(&c->value, c->value_type), c->value_type), dt);
vnode_free(&c->value, c->value_type); vnode_free(&c->value, c->value_type);
@ -94,8 +94,8 @@ bool libcdsb_dict_inject(dict_t* x, vtype_variable key, vtype_variable value, vo
while (!is_null(c)) { while (!is_null(c)) {
if (vtype_compare(key.pointer, key.type, vnode_peek(&c->key, c->key_type), c->key_type) == 0) { if (vtype_compare(key.pointer, key.type, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
if (!callback) callback(libcdsb_variable_build(vnode_peek(&c->key, c->key_type), c->key_type), if (callback) callback(libcdsb_variable_build(vnode_peek(&c->key, c->key_type), c->key_type),
libcdsb_variable_build(vnode_peek(&c->value, c->value_type), c->value_type), dt); libcdsb_variable_build(vnode_peek(&c->value, c->value_type), c->value_type), dt);
vnode_free(&c->key, c->key_type); vnode_free(&c->key, c->key_type);
vnode_free(&c->value, c->value_type); vnode_free(&c->value, c->value_type);