Exemple #1
0
void zone_tree_deep_free(zone_tree_t **tree)
{
	if (tree == NULL || *tree == NULL) {
		return;
	}

	zone_tree_apply(*tree, zone_tree_free_node, NULL);
	zone_tree_free(tree);
}
Exemple #2
0
static int knot_zone_diff_load_trees(zone_tree_t *nodes1,
                                     zone_tree_t *nodes2,
                                     changeset_t *changeset)
{
	assert(changeset);

	struct zone_diff_param param = { 0 };
	param.changeset = changeset;

	// Traverse one tree, compare every node, each RRSet with its rdata.
	param.nodes = nodes2;
	int result = zone_tree_apply(nodes1, knot_zone_diff_node, &param);
	if (result != KNOT_EOK) {
		return result;
	}

	// Some nodes may have been added. Add missing nodes to changeset.
	param.nodes = nodes1;
	result = zone_tree_apply(nodes2, knot_zone_diff_add_new_nodes, &param);

	return result;
}