From bc69fbb7cc3363e51cc6a9365d35c34ea78e4d93 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 23 Mar 2023 18:11:34 +0300 Subject: [PATCH] Fix modifying of map & set --- src/map/modify.c | 4 ++-- src/set/modify.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/map/modify.c b/src/map/modify.c index 2b071e5..7c77a3e 100644 --- a/src/map/modify.c +++ b/src/map/modify.c @@ -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), diff --git a/src/set/modify.c b/src/set/modify.c index a37e4f8..9f0abc3 100644 --- a/src/set/modify.c +++ b/src/set/modify.c @@ -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);