From 151733327589217e84c5ac7006b9076f428c53a0 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 5 Dec 2015 12:33:26 +0100 Subject: cppification: GSList replaced by vectors (mostly related to guides and grids) (bzr r14504.1.1) --- src/sp-mask.cpp | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'src/sp-mask.cpp') diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index 5f7a2ec26..7b9ab11c3 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -138,23 +138,18 @@ void SPMask::update(SPCtx* ctx, unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; - GSList *l = NULL; - for (SPObject *child = this->firstChild(); child; child = child->getNext()) { - sp_object_ref(child); - l = g_slist_prepend (l, child); + std::vector children = this->childList(false); + for (std::vector::const_iterator child = children.begin();child != children.end();child++) { + sp_object_ref(*child); } - l = g_slist_reverse (l); - while (l) { - SPObject *child = SP_OBJECT(l->data); - l = g_slist_remove(l, child); - - if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { - child->updateDisplay(ctx, flags); + for (std::vector::const_iterator child = children.begin();child != children.end();child++) { + if (flags || ((*child)->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { + (*child)->updateDisplay(ctx, flags); } - sp_object_unref(child); + sp_object_unref(*child); } for (SPMaskView *v = this->display; v != NULL; v = v->next) { @@ -177,23 +172,17 @@ void SPMask::modified(unsigned int flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; - GSList *l = NULL; - for (SPObject *child = this->firstChild(); child; child = child->getNext()) { - sp_object_ref(child); - l = g_slist_prepend(l, child); + std::vector children = this->childList(false); + for (std::vector::const_iterator child = children.begin();child != children.end();child++) { + sp_object_ref(*child); } - l = g_slist_reverse(l); - - while (l) { - SPObject *child = SP_OBJECT(l->data); - l = g_slist_remove(l, child); - - if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { - child->emitModified(flags); + for (std::vector::const_iterator child = children.begin();child != children.end();child++) { + if (flags || ((*child)->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { + (*child)->emitModified(flags); } - sp_object_unref(child); + sp_object_unref(*child); } } -- cgit v1.2.3