From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/sp-switch.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/sp-switch.cpp') diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp index db6db9909..0090f1855 100644 --- a/src/sp-switch.cpp +++ b/src/sp-switch.cpp @@ -55,21 +55,22 @@ SPObject *SPSwitch::_evaluateFirst() { return first; } -GSList *SPSwitch::_childList(bool add_ref, SPObject::Action action) { +SelContainer SPSwitch::_childList(bool add_ref, SPObject::Action action) { if ( action != SPObject::ActionGeneral ) { return this->childList(add_ref, action); } SPObject *child = _evaluateFirst(); + SelContainer x; if (NULL == child) - return NULL; + return x; if (add_ref) { //g_object_ref (G_OBJECT (child)); sp_object_ref(child); } - - return g_slist_prepend (NULL, child); + x.push_front(child); + return x; } const char *SPSwitch::displayName() const { @@ -109,10 +110,9 @@ void SPSwitch::_reevaluate(bool /*add_to_drawing*/) { _releaseLastItem(_cached_item); - for ( GSList *l = _childList(false, SPObject::ActionShow); - NULL != l ; l = g_slist_remove (l, l->data)) - { - SPObject *o = SP_OBJECT (l->data); + SelContainer item_list = _childList(false, SPObject::ActionShow); + for ( SelContainer::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { + SPObject *o = SP_OBJECT (*iter); if ( !SP_IS_ITEM (o) ) { continue; } @@ -144,10 +144,10 @@ void SPSwitch::_releaseLastItem(SPObject *obj) void SPSwitch::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) { SPObject *evaluated_child = this->_evaluateFirst(); - GSList *l = this->_childList(false, SPObject::ActionShow); + SelContainer l = this->_childList(false, SPObject::ActionShow); - while (l) { - SPObject *o = SP_OBJECT (l->data); + for ( SelContainer::const_iterator iter=l.begin();iter!=l.end();iter++) { + SPObject *o = SP_OBJECT (*iter); if (SP_IS_ITEM (o)) { SPItem * child = SP_ITEM(o); @@ -158,8 +158,6 @@ void SPSwitch::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem ai->appendChild(ac); } } - - l = g_slist_remove (l, o); } } -- cgit v1.2.3