Add function to get the parent of a given node.

This commit is contained in:
Vreixo Formoso 2008-01-10 22:10:11 +01:00
parent e9e1d28333
commit 53c2215ab3
2 changed files with 27 additions and 0 deletions

View File

@ -836,6 +836,18 @@ int iso_node_take(IsoNode *node);
*/ */
int iso_node_remove(IsoNode *node); int iso_node_remove(IsoNode *node);
/*
* Get the parent of the given iso tree node. No extra ref is added to the
* returned directory, you must take your ref. with iso_node_ref() if you
* need it.
*
* If node is the root node, the same node will be returned as its parent.
*
* This returns NULL if the node doesn't pertain to any tree
* (it was removed/take).
*/
IsoDir *iso_node_get_parent(IsoNode *node);
/** /**
* Get an iterator for the children of the given dir. * Get an iterator for the children of the given dir.
* *

View File

@ -489,6 +489,21 @@ int iso_node_remove(IsoNode *node)
return ret; return ret;
} }
/*
* Get the parent of the given iso tree node. No extra ref is added to the
* returned directory, you must take your ref. with iso_node_ref() if you
* need it.
*
* If node is the root node, the same node will be returned as its parent.
*
* This returns NULL if the node doesn't pertain to any tree
* (it was removed/take).
*/
IsoDir *iso_node_get_parent(IsoNode *node)
{
return node->parent;
}
/* TODO #00005 optimize iso_dir_iter_take */ /* TODO #00005 optimize iso_dir_iter_take */
int iso_dir_iter_take(IsoDirIter *iter) int iso_dir_iter_take(IsoDirIter *iter)
{ {