summaryrefslogtreecommitdiffstats
path: root/src/sp-flowtext.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2017-10-01 21:57:52 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2017-10-01 21:57:52 +0000
commitc20891fabc8c3ee2251e0545878e06545b6f0cdd (patch)
treec19727ea5ec4c7fb90b7e4512a3cc5fb89f58945 /src/sp-flowtext.cpp
parentMerge branch 'master' of gitlab.com:inkscape/inkscape (diff)
downloadinkscape-c20891fabc8c3ee2251e0545878e06545b6f0cdd.tar.gz
inkscape-c20891fabc8c3ee2251e0545878e06545b6f0cdd.zip
First batch
Diffstat (limited to 'src/sp-flowtext.cpp')
-rw-r--r--src/sp-flowtext.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index c5af85774..2425dada3 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -65,19 +65,14 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) {
}
childflags &= SP_OBJECT_MODIFIED_CASCADE;
- GSList *l = NULL;
-
+ std::vector<SPObject *> l;
for (auto& child: children) {
sp_object_ref(&child);
- l = g_slist_prepend(l, &child);
+ l.push_back(&child);
}
- l = g_slist_reverse(l);
-
- while (l) {
- SPObject *child = reinterpret_cast<SPObject *>(l->data);
+ for (auto child:l) {
g_assert(child != NULL);
- l = g_slist_remove(l, child);
if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
SPItem *item = dynamic_cast<SPItem *>(child);
@@ -216,7 +211,7 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X
repr = doc->createElement("svg:flowRoot");
}
- GSList *l = NULL;
+ std::vector<Inkscape::XML::Node *> l;
for (auto& child: children) {
Inkscape::XML::Node *c_repr = NULL;
@@ -226,14 +221,13 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X
}
if ( c_repr ) {
- l = g_slist_prepend(l, c_repr);
+ l.push_back(c_repr);
}
}
- while ( l ) {
- repr->addChild((Inkscape::XML::Node *) l->data, NULL);
- Inkscape::GC::release((Inkscape::XML::Node *) l->data);
- l = g_slist_remove(l, l->data);
+ for (auto i=l.rbegin();i!=l.rend();++i) {
+ repr->addChild(*i, NULL);
+ Inkscape::GC::release(*i);
}
} else {
for (auto& child: children) {