Beispiel #1
0
/*
 * Free an XML node
 */
void
xml_node_free(xml_node_t *node)
{
	xml_node_t *child;

	if (!node)
		return;

	ni_assert(node->refcount);
	if (--(node->refcount) != 0)
		return;

	while ((child = node->children) != NULL) {
		node->children = child->next;
		xml_node_free(child);
	}

	if (node->location)
		xml_location_free(node->location);

	ni_var_array_destroy(&node->attrs);
	free(node->cdata);
	free(node->name);
	free(node);
}
Beispiel #2
0
void
xml_node_location_set(xml_node_t *node, xml_location_t *loc)
{
	if (node->location == loc)
		return;
	if (node->location)
		xml_location_free(node->location);

	node->location = loc;
}