From f9c2a80c16d0c77fd4156181817d3b13b1037aec Mon Sep 17 00:00:00 2001 From: Jan Lingscheid Date: Tue, 12 Sep 2017 12:06:22 +0200 Subject: Remove usage of GString in sp-style-elem.cpp --- src/sp-style-elem.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/sp-style-elem.cpp') diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 694334d23..1a3c194b9 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -106,14 +106,14 @@ Inkscape::XML::Node* SPStyleElem::write(Inkscape::XML::Document* xml_doc, Inksca /** Returns the concatenation of the content of the text children of the specified object. */ -static GString * +static Glib::ustring concat_children(Inkscape::XML::Node const &repr) { - GString *ret = g_string_sized_new(0); - // effic: 0 is just to catch bugs. Increase to something reasonable. + Glib::ustring ret; + // effic: Initialising ret to a reasonable starting size could speed things up. for (Inkscape::XML::Node const *rch = repr.firstChild(); rch != NULL; rch = rch->next()) { if ( rch->type() == TEXT_NODE ) { - ret = g_string_append(ret, rch->content()); + ret += rch->content(); } } return ret; @@ -376,9 +376,9 @@ void SPStyleElem::read_content() { ParseTmp *parse_tmp = reinterpret_cast(sac_handler->app_data); //XML Tree being used directly here while it shouldn't be. - GString *const text = concat_children(*getRepr()); + Glib::ustring const text = concat_children(*getRepr()); CRStatus const parse_status = - cr_parser_parse_buf (parser, reinterpret_cast(text->str), text->len, CR_UTF_8); + cr_parser_parse_buf (parser, reinterpret_cast(text.c_str()), text.bytes(), CR_UTF_8); // std::cout << "SPStyeElem::read_content: result:" << std::endl; // const gchar* string = cr_stylesheet_to_string (document->style_sheet); -- cgit v1.2.3