Fix the return value of tommy_tree_insert()

It must be the object in the tree and not the passed one.
No bad conseguence because the value was used only for assertions,
and not for controlling the behaviour.
This commit is contained in:
Andrea Mazzoleni 2016-10-26 22:58:28 +02:00
parent 20e9f7de41
commit 9b2c5514c0
2 changed files with 3 additions and 6 deletions

View file

@ -439,11 +439,8 @@ static void test_tommy(void)
tommy_tree_insert(&tree, &node[i], (void*)(uintptr_t)(i + 1));
/* try to insert a duplicate, count should not change */
if (tommy_tree_insert(&tree, &node[TOMMY_SIZE], (void*)1) != (void*)1) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
tommy_tree_insert(&tree, &node[TOMMY_SIZE], (void*)(uintptr_t)1);
if (tommy_tree_count(&tree) != TOMMY_SIZE) {
/* LCOV_EXCL_START */
goto bail;

View file

@ -152,7 +152,7 @@ void* tommy_tree_insert(tommy_tree* tree, tommy_tree_node* node, void* data)
if (insert == node)
++tree->count;
return node->data;
return insert->data;
}
static tommy_tree_node* tommy_tree_remove_node(tommy_compare_func* cmp, tommy_tree_node* root, void* data, tommy_tree_node** let)