summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-10-20 23:03:09 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-10-20 23:05:54 +0300
commitccc3a38949e3598dcdb36f604600d1a228c0a6e2 (patch)
tree3cbc40fdeb9dcbd2390c2dc769cc66b8eebce91d
parent3925fa74c9a1110f4b2032d2c594ed5d7ef5384b (diff)
downloadlibsunavl-ccc3a38949e3598dcdb36f604600d1a228c0a6e2.tar.gz
Make it portable
-rw-r--r--usr/src/common/avl/avl.c28
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;