/* Returns: the found child #GNode, or NULL if the data is not found  */
GNode* g_node_find_child(GNode *node, GTraverseFlags flags, gpointer data)
/* Returns: the found child #GNode, or NULL if the data is not found  */
GNode* g_node_find_child(GNode *node, GTraverseFlags flags, gpointer data)
{
  g_return_val_if_fail (node != NULL, NULL);
  g_return_val_if_fail (flags <= G_TRAVERSE_MASK, NULL);
  node = node->children;
  while (node)
    {
      if (node->data == data)
	{
	  if (G_NODE_IS_LEAF (node))
	    {
	      if (flags & G_TRAVERSE_LEAFS)
		return node;
	    }
	  else
	    {
	      if (flags & G_TRAVERSE_NON_LEAFS)
		return node;
	    }
	}
      node = node->next;
    }
  return NULL;
}