Skip to content

Commit 669da4c

Browse files
committed
Fix rb_remove() to use node's key for comparison
The origin code was erroneously comparing node->data when searching for the node to remove, instead of using the node->key. This commit corrects the comparison to use the node->key, ensuring the proper removal of nodes.
1 parent a210f74 commit 669da4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static void rb_remove(map_t rb, map_node_t *node)
221221
pathp = path;
222222
while (pathp->node) {
223223
map_cmp_t cmp = pathp->cmp =
224-
(rb->comparator)(node->data, pathp->node->data);
224+
(rb->comparator)(node->key, pathp->node->key);
225225
if (cmp == _CMP_LESS) {
226226
pathp[1].node = rb_node_get_left(pathp->node);
227227
} else {

0 commit comments

Comments
 (0)