/** * Free an XML tree, recursively. */ void xnode_tree_free(xnode_t *root) { etree_t t; xnode_check(root); etree_init_root(&t, root, TRUE, offsetof(xnode_t, node)); etree_free(&t, xnode_item_free); }
/** * Free sub-tree, destroying all its items and removing the reference in * the parent node, if any. * * @param tree the tree descriptor * @param item root item of sub-tree to remove * @param fcb free routine for each item */ void etree_sub_free(etree_t *tree, void *item, free_fn_t fcb) { etree_t dtree; etree_check(tree); etree_detach(tree, item); etree_init_root(&dtree, item, etree_is_extended(tree), tree->offset); etree_free(&dtree, fcb); }