Skip to content

Commit cd1d712

Browse files
authored
Merge pull request #250 from visitorckw/fix/rb-remove-key-comparison
Fix rb_remove() key comparison
2 parents a210f74 + 3736827 commit cd1d712

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
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 {

tests/map/test-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static int test_map_mixed_operations()
2929
*/
3030
for (int i = 0; i < N_NODES; i++) {
3131
key[i] = i;
32-
val[i] = i + 1;
32+
val[i] = mt19937_extract();
3333
}
3434

3535
for (int i = 0; i < N_NODES; i++) {

0 commit comments

Comments
 (0)