FreeBSD/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c
/*
 * Free all the handles associated with this list.
 */
Free all the handles associated with this list.
Free all the handles associated with this list .
void
pool_list_free(zpool_list_t *zlp)
{
	uu_avl_walk_t *walk;
	zpool_node_t *node;
	if ((walk = uu_avl_walk_start(zlp->zl_avl, UU_WALK_ROBUST)) == NULL) {
		(void) fprintf(stderr,
		    gettext("internal error: out of memory"));
		exit(1);
	}
	while ((node = uu_avl_walk_next(walk)) != NULL) {
		uu_avl_remove(zlp->zl_avl, node);
		zpool_close(node->zn_handle);
		free(node);
	}
	uu_avl_walk_end(walk);
	uu_avl_destroy(zlp->zl_avl);
	uu_avl_pool_destroy(zlp->zl_pool);
	free(zlp);
}
void pool_list_free ( zpool_list_t * zlp ) { uu_avl_walk_t * walk ; zpool_node_t * node ; if ( ( walk = uu_avl_walk_start ( zlp -> zl_avl , UU_WALK_ROBUST ) ) == NULL ) { ( void ) fprintf ( stderr , gettext ( " " ) ) ; exit ( 1 ) ; } while ( ( node = uu_avl_walk_next ( walk ) ) != NULL ) { uu_avl_remove ( zlp -> zl_avl , node ) ; zpool_close ( node -> zn_handle ) ; free ( node ) ; } uu_avl_walk_end ( walk ) ; uu_avl_destroy ( zlp -> zl_avl ) ; uu_avl_pool_destroy ( zlp -> zl_pool ) ; free ( zlp ) ; }
Free all the handles associated with this list.
Free all the handles associated with this list .