diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-03-05 18:58:12 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-03-06 22:08:36 +0100 |
commit | 919d1e85f2cc17059f72db48c3bc38e0b524f6c0 (patch) | |
tree | cac9b227ee4edac72b7c850370c23cbcf68d3d93 /tests/libutil/rbtree.c | |
parent | 02db0ae8ff83a42913b1b4224ccd8377f5fc5323 (diff) |
Add a context pointer to the rbtree key comparison
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/libutil/rbtree.c')
-rw-r--r-- | tests/libutil/rbtree.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/libutil/rbtree.c b/tests/libutil/rbtree.c index 03c0025..25c9b61 100644 --- a/tests/libutil/rbtree.c +++ b/tests/libutil/rbtree.c @@ -9,8 +9,9 @@ #include "rbtree.h" #include "../test.h" -static int key_compare(const void *a, const void *b) +static int key_compare(const void *ctx, const void *a, const void *b) { + (void)ctx; return *((sqfs_s32 *)a) - *((sqfs_s32 *)b); } @@ -66,14 +67,14 @@ static void check_binary_tree_dfs(rbtree_node_t *n) if (n->left != NULL) { cmp = rbtree_node_key(n->left); - TEST_ASSERT(key_compare(cmp, key) < 0); + TEST_ASSERT(key_compare(NULL, cmp, key) < 0); check_binary_tree_dfs(n->left); } if (n->right != NULL) { cmp = rbtree_node_key(n->right); - TEST_ASSERT(key_compare(cmp, key) > 0); + TEST_ASSERT(key_compare(NULL, cmp, key) > 0); check_binary_tree_dfs(n->right); } |