/* Unlinks a #GNode from a tree, resulting in two separate trees.  */
void g_node_unlink(GNode *node)
/* Unlinks a #GNode from a tree, resulting in two separate trees.  */
void g_node_unlink(GNode *node)
{
  g_return_if_fail (node != NULL);
  if (node->prev)
    node->prev->next = node->next;
  else if (node->parent)
    node->parent->children = node->next;
  node->parent = NULL;
  if (node->next)
    {
      node->next->prev = node->prev;
      node->next = NULL;
    }
  node->prev = NULL;
}