X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=buffer_tree.c;h=b1eeb0363e3741d288656e8c5cea5aa9d186c0ab;hp=fd0a59cad58c0027e3911b08eb5f0bd20a176ed5;hb=f24778705c853647f48b89c8d27ba1ded27a6f29;hpb=cde823b8c072f5baac17fa43a0e5608e09936d72 diff --git a/buffer_tree.c b/buffer_tree.c index fd0a59ca..b1eeb036 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -544,14 +544,16 @@ static bool btr_no_children(struct btr_node *btrn) } /** - * Find out whether a node is an orphan node. + * Find out whether a node is an orphan. * * \param btrn The buffer tree node. * * \return True if \a btrn has no parent. * - * This function will always return true for the root node. However in case - * nodes have been removed from the tree, other nodes may become orphans too. + * This function returns true for the root node and false for any other node. + * + * After a (non-leaf) node was removed removed from the tree, the function + * returns true for all child nodes. */ bool btr_no_parent(struct btr_node *btrn) { @@ -856,6 +858,8 @@ void btr_splice_out_node(struct btr_node *btrn) 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;