Print this page
6222 libuutil could provide a way to re-create an AVL tree
@@ -19,14 +19,14 @@
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "libuutil_common.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -272,10 +272,20 @@
avl_destroy(&ap->ua_tree);
uu_free(ap);
}
+void
+uu_avl_recreate(uu_avl_t *ap)
+{
+ uu_avl_pool_t *pp = ap->ua_pool;
+
+ avl_destroy(&ap->ua_tree);
+ avl_create(&ap->ua_tree, &uu_avl_node_compare, pp->uap_objsize,
+ pp->uap_nodeoffset);
+}
+
size_t
uu_avl_numnodes(uu_avl_t *ap)
{
return (avl_numnodes(&ap->ua_tree));
}