Ejemplo n.º 1
0
void dbtree_destroy(dbtree *tree) {
    if (tree->next)
	dbtree_destroy(tree->next);
    if (tree->child)
	dbtree_destroy(tree->child);
    while (tree) {
	dbtree *next = tree->next;
	if (tree->size > 0 && tree->value != NULL)
	    free(tree->value);
	free(tree);
	tree = next;
    }
}
Ejemplo n.º 2
0
static int
ik_btr_close_destroy(bool destroy)
{
	int rc;

	if (daos_handle_is_inval(ik_toh)) {
		D_ERROR("Invalid tree open handle\n");
		return -1;
	}

	if (destroy) {
		D_PRINT("Destroy btree\n");
		rc = dbtree_destroy(ik_toh);
	} else {
		D_PRINT("Close btree\n");
		rc = dbtree_close(ik_toh);
	}

	ik_toh = DAOS_HDL_INVAL;
	if (rc != 0) {
		D_ERROR("Tree %s failed: %d\n",
			destroy ? "destroy" : "close", rc);
		return -1;
	}
	return rc;
}