From 919d1e85f2cc17059f72db48c3bc38e0b524f6c0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 5 Mar 2021 18:58:12 +0100 Subject: Add a context pointer to the rbtree key comparison Signed-off-by: David Oberhollenzer --- tests/libutil/rbtree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/libutil') 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); } -- cgit v1.2.3