diff --git a/cmdline/selftest.c b/cmdline/selftest.c index f0ac9441..d00b3bbc 100644 --- a/cmdline/selftest.c +++ b/cmdline/selftest.c @@ -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; diff --git a/tommyds/tommytree.c b/tommyds/tommytree.c index b67b2408..6b2f1a99 100644 --- a/tommyds/tommytree.c +++ b/tommyds/tommytree.c @@ -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)