summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-25 10:52:19 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-25 10:52:19 (EDT)
commit874fb4df5108783c4a4c250619b3159a1ef1df67 (patch)
tree2334e345952d0b1c53b08820769515df01fe790d /src
parent46876f615c096a0ba85cd40b2494cfbaaec186b5 (diff)
downloadmarquee-874fb4df5108783c4a4c250619b3159a1ef1df67.zip
marquee-874fb4df5108783c4a4c250619b3159a1ef1df67.tar.gz
marquee-874fb4df5108783c4a4c250619b3159a1ef1df67.tar.bz2
mq_tree_remove*(): Link node's next sibling or parent to last child
Diffstat (limited to 'src')
-rw-r--r--src/tree.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tree.c b/src/tree.c
index a279fd8..2e0e875 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -183,14 +183,16 @@ mq_tree_remove_allocated(MqTree *node)
{
MqTree *child;
- /* Link previous sibling or parent to children. */
+ /* Link siblings and/or parent to children (may be NULL). */
if (node->prev) {
node->prev->next = node->first_child;
} else {
node->parent->first_child = node->first_child;
- if (!node->next) {
- node->parent->last_child = node->last_child;
- }
+ }
+ if (node->next) {
+ node->next->prev = node->last_child;
+ } else {
+ node->parent->last_child = node->last_child;
}
/* Link children to siblings (may be NULL). */