diff options
-rw-r--r-- | usr/src/common/avl/avl.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/usr/src/common/avl/avl.c b/usr/src/common/avl/avl.c index 2d07c54..1e59584 100644 --- a/usr/src/common/avl/avl.c +++ b/usr/src/common/avl/avl.c @@ -634,26 +634,12 @@ avl_insert_here( /* * Add a new node to an AVL tree. */ +// XXX: Use return value for non-null avl_find! void avl_add(avl_tree_t *tree, void *new_node) { - avl_index_t where; - - /* - * This is unfortunate. We want to call panic() here, even for - * non-DEBUG kernels. In userland, however, we can't depend on anything - * in libc or else the rtld build process gets confused. - * Thankfully, rtld provides us with its own assfail() so we can use - * that here. We use assfail() directly to get a nice error message - * in the core - much like what panic() does for crashdumps. - */ - if (avl_find(tree, new_node, &where) != NULL) -#ifdef _KERNEL - panic("avl_find() succeeded inside avl_add()"); -#else - (void) assfail("avl_find() succeeded inside avl_add()", - __FILE__, __LINE__); -#endif + avl_index_t where = -1; + (void) avl_find(tree, new_node, &where); avl_insert(tree, new_node, where); } @@ -888,11 +874,11 @@ void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) { avl_node_t *temp_node; - ulong_t temp_numnodes; + size_t temp_numnodes; - ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); - ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); - ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + ASSERT(tree1->avl_compar == tree2->avl_compar); + ASSERT(tree1->avl_offset == tree2->avl_offset); + ASSERT(tree1->avl_size == tree2->avl_size); temp_node = tree1->avl_root; temp_numnodes = tree1->avl_numnodes; |