diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-25 10:52:19 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-25 10:52:19 (EDT) |
commit | 874fb4df5108783c4a4c250619b3159a1ef1df67 (patch) | |
tree | 2334e345952d0b1c53b08820769515df01fe790d /src | |
parent | 46876f615c096a0ba85cd40b2494cfbaaec186b5 (diff) | |
download | marquee-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.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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). */ |