From c9cb27be11252cd975b5ee7b87dc95e85fc43716 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Thu, 14 Aug 2014 07:40:13 +0200 Subject: [PATCH] mu: Make mu_container_splice_grandchildren() do only one thing Don't kill the resultant childless container when promoting its children. This unifies the behavior of mu_container_splice_*() functions. --- lib/mu-container.c | 2 -- lib/mu-container.h | 2 +- lib/mu-threader.c | 6 ++++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mu-container.c b/lib/mu-container.c index f0743ac5..7722b64a 100644 --- a/lib/mu-container.c +++ b/lib/mu-container.c @@ -290,8 +290,6 @@ mu_container_splice_grandchildren (MuContainer *parent, MuContainer *child) newchild = child->child; child->child=NULL; - mu_container_remove_child (parent, child); - return mu_container_append_children (parent, newchild); } diff --git a/lib/mu-container.h b/lib/mu-container.h index 6cd76889..5bc268b9 100644 --- a/lib/mu-container.h +++ b/lib/mu-container.h @@ -140,7 +140,7 @@ MuContainer* mu_container_splice_children (MuContainer *c, MuContainer *sibling); /** - * promote child's children to be parent's children and remove child + * promote child's children to be parent's children * * @param parent a container instance * @param child a child of this container diff --git a/lib/mu-threader.c b/lib/mu-threader.c index 1bb4c0f5..d32bbe7a 100644 --- a/lib/mu-threader.c +++ b/lib/mu-threader.c @@ -385,10 +385,12 @@ prune_maybe (MuContainer *c) MuContainer *cur; for (cur = c->child; cur; cur = cur->next) { - if (cur->flags & MU_CONTAINER_FLAG_DELETE) + if (cur->flags & MU_CONTAINER_FLAG_DELETE) { c = mu_container_remove_child (c, cur); - else if (cur->flags & MU_CONTAINER_FLAG_SPLICE) + } else if (cur->flags & MU_CONTAINER_FLAG_SPLICE) { c = mu_container_splice_grandchildren (c, cur); + c = mu_container_remove_child (c, cur); + } } g_return_val_if_fail (c, FALSE);