/*
- * Copyright (C) 2009-2012 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2009-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
ch->parent = btrn->parent;
if (btrn->parent)
list_move(&ch->node, &btrn->parent->children);
+ else
+ list_del(&ch->node);
}
assert(list_empty(&btrn->children));
btrn->parent = NULL;
*tv = btrn->start;
}
+/**
+ * Get the parent node of a buffer tree node.
+ *
+ * \param btrn The node whose parent should be returned.
+ *
+ * \a btrn must not be \p NULL.
+ *
+ * \return The parent of \a btrn, or \p NULL if \a btrn is the
+ * root node of the buffer tree.
+ */
struct btr_node *btr_parent(struct btr_node *btrn)
{
return btrn->parent;