aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/rb_tree_test.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-09-19 15:17:24 -0500
committerJason Ekstrand <[email protected]>2019-09-20 17:37:25 +0000
commitdae33052dbfec843d5e997dbd93049d702977fa6 (patch)
treeecb34fd5b67cae561df8d2cb187abcaf379763f4 /src/util/rb_tree_test.c
parentd35d7346d2446d8638b90425607c3f25fc339008 (diff)
util/rb_tree: Reverse the order of comparison functions
The new order matches that of the comparison functions accepted by the C standard library qsort() functions. Being consistent with qsort will hopefully help avoid developer confusion. The only current user of the red-black tree is aub_mem.c which is pretty easy to fix up. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/util/rb_tree_test.c')
-rw-r--r--src/util/rb_tree_test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/rb_tree_test.c b/src/util/rb_tree_test.c
index c56a90e83c5..a5952b3b52d 100644
--- a/src/util/rb_tree_test.c
+++ b/src/util/rb_tree_test.c
@@ -56,7 +56,7 @@ static int
rb_test_node_cmp_void(const struct rb_node *n, const void *v)
{
struct rb_test_node *tn = rb_node_data(struct rb_test_node, n, node);
- return tn->key - *(int *)v;
+ return *(int *)v - tn->key;
}
static int
@@ -65,7 +65,7 @@ rb_test_node_cmp(const struct rb_node *a, const struct rb_node *b)
struct rb_test_node *ta = rb_node_data(struct rb_test_node, a, node);
struct rb_test_node *tb = rb_node_data(struct rb_test_node, b, node);
- return ta->key - tb->key;
+ return tb->key - ta->key;
}
static void