mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
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:
parent
20e9f7de41
commit
9b2c5514c0
2 changed files with 3 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue