Fix modifying of map & set

This commit is contained in:
Gregory Lirent 2023-03-23 18:11:34 +03:00
parent faca7da0c3
commit bc69fbb7cc
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ bool libcdsb_map_update(map_t* x, vtype_variable key, vtype_variable value, void
if (!mnode_is_empty(n = x->root)) {
do {
p = n;
cmp = vtype_compare(key.pointer, key.type, vnode_peek(&n->key, key.type), key.type);
cmp = vtype_compare(key.pointer, key.type, vnode_peek(&n->key, x->type), x->type);
if (cmp == 0) {
if (callback) callback(libcdsb_variable_build(vnode_peek(&n->key, x->type), x->type),
@ -58,7 +58,7 @@ bool libcdsb_map_inject(map_t* x, vtype_variable key, vtype_variable value, void
if (!mnode_is_empty(n)) {
do {
p = n;
cmp = vtype_compare(key.pointer, key.type, vnode_peek(&n->key, key.type), key.type);
cmp = vtype_compare(key.pointer, key.type, vnode_peek(&n->key, x->type), x->type);
if (cmp == 0) {
if (callback) callback(libcdsb_variable_build(vnode_peek(&n->key, x->type), x->type),

View File

@ -13,7 +13,7 @@ bool libcdsb_vset_insert(set_t* x, vtype_variable value) {
if (!rbnode_is_empty(n = x->root)) {
do {
p = n;
cmp = vtype_compare(value.pointer, value.type, vnode_peek(&n->value, value.type), value.type);
cmp = vtype_compare(value.pointer, value.type, vnode_peek(&n->value, x->type), x->type);
if (cmp == 0) return false;
@ -50,7 +50,7 @@ bool libcdsb_vset_attach(set_t* x, vtype_variable value) {
if (!rbnode_is_empty(n)) {
do {
p = n;
cmp = vtype_compare(value.pointer, value.type, vnode_peek(&n->value, value.type), value.type);
cmp = vtype_compare(value.pointer, value.type, vnode_peek(&n->value, x->type), x->type);
if (cmp == 0) {
vnode_free(&vn, value.type);