Esempio n. 1
0
File: mu-threader.c Progetto: nd/mu
static MuContainer*
prune_empty_containers (MuContainer *root_set)
{
	MuContainer *cur;

	mu_container_foreach (root_set,
			      (MuContainerForeachFunc)prune_maybe,
			      NULL);

	/* and prune the root_set itself... */
	for (cur = root_set; cur; cur = cur->next) {

		if (cur->flags & MU_CONTAINER_FLAG_DELETE)
			root_set = mu_container_remove_sibling (root_set, cur);

		else if (cur->flags & MU_CONTAINER_FLAG_SPLICE) {
			MuContainer *newchild;
			newchild = cur->child;
			cur->child = NULL;
			root_set = mu_container_append_siblings (root_set,
								 newchild);
		}
	}

	return root_set;
}
Esempio n. 2
0
gboolean
mu_container_foreach (MuContainer *c, MuContainerForeachFunc func,
		      gpointer user_data)
{
	g_return_val_if_fail (func, FALSE);

	if (!c)
		return TRUE;

	if (!mu_container_foreach (c->child, func, user_data))
		return FALSE; /* recurse into children */

	/* recurse into siblings */
	if (!mu_container_foreach (c->next, func, user_data))
		return FALSE;

	return func (c, user_data);
}
Esempio n. 3
0
gboolean
mu_container_reachable (MuContainer *haystack, MuContainer *needle)
{
	g_return_val_if_fail (haystack, FALSE);
	g_return_val_if_fail (needle, FALSE);

	if (!mu_container_foreach
	    (haystack, (MuContainerForeachFunc)unequal, needle))
		return TRUE;

	return FALSE;
}
Esempio n. 4
0
G_GNUC_UNUSED static void
assert_no_duplicates (MuContainer *c)
{
	GHashTable *hash;

	hash = g_hash_table_new (g_direct_hash, g_direct_equal);

	mu_container_foreach (c,
			   (MuContainerForeachFunc)check_dup,
			   hash);

	g_hash_table_destroy (hash);
}
Esempio n. 5
0
void
mu_container_dump (MuContainer *c, gboolean recursive)
{
	g_return_if_fail (c);

	if (!recursive)
		dump_container (c);
	else
		mu_container_foreach
			(c,
			 (MuContainerForeachFunc)dump_container,
			 NULL);
}