From 485e68cc1dc477d7bb6c03924bece9bca8abc6bd Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Tue, 25 Sep 2018 00:00:28 +0200 Subject: Clean up stream output in repr-io.cpp - remove workaround that was necessary because of broken writeString (and consequently printf) functions of BasicWriter - use writeChar() where appropriate as it's slightly more efficient than writeString() --- src/xml/repr-io.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src/xml/repr-io.cpp') diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 0fdd891a2..8e6a606e1 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -772,24 +772,15 @@ static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespa if (addWhitespace && indent) { for (gint i = 0; i < indentLevel; i++) { for (gint j = 0; j < indent; j++) { - out.writeString(" "); + out.writeChar(' '); } } } - out.writeString(""); + out.printf("", val); if (addWhitespace) { - out.writeString("\n"); + out.writeChar('\n'); } } @@ -976,7 +967,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, if (add_whitespace && indent) { for (gint i = 0; i < indent_level; i++) { for (gint j = 0; j < indent; j++) { - out.writeString(" "); + out.writeChar(' '); } } } @@ -1002,11 +993,11 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, iter ; ++iter ) { if (!inlineattrs) { - out.writeString("\n"); + out.writeChar('\n'); if (indent) { for ( gint i = 0 ; i < indent_level + 1 ; i++ ) { for ( gint j = 0 ; j < indent ; j++ ) { - out.writeString(" "); + out.writeChar(' '); } } } @@ -1024,9 +1015,9 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, } } if (repr->firstChild()) { - out.writeString( ">" ); + out.writeChar('>'); if (loose && add_whitespace) { - out.writeString( "\n" ); + out.writeChar('\n'); } for (child = repr->firstChild(); child != nullptr; child = child->next()) { sp_repr_write_stream(child, out, ( loose ? indent_level + 1 : 0 ), @@ -1037,7 +1028,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, if (loose && add_whitespace && indent) { for (gint i = 0; i < indent_level; i++) { for ( gint j = 0 ; j < indent ; j++ ) { - out.writeString(" "); + out.writeChar(' '); } } } @@ -1050,7 +1041,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out, // after closing text if (add_whitespace || !strcmp (repr->name(), "svg:text")) { - out.writeString( "\n" ); + out.writeChar('\n'); } } -- cgit v1.2.3