aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-23 20:18:20 +0000
committerDavid Robillard <d@drobilla.net>2011-01-23 20:18:20 +0000
commit0993d312cb18131de8aa5a73eda65305f8f7899b (patch)
treeb3f15437587d5e4414318bda832a3f37b81c33f4 /src/writer.c
parent2c45a0e0d3e89946726c76f0e68b12048fb48785 (diff)
downloadserd-0993d312cb18131de8aa5a73eda65305f8f7899b.tar.gz
serd-0993d312cb18131de8aa5a73eda65305f8f7899b.tar.bz2
serd-0993d312cb18131de8aa5a73eda65305f8f7899b.zip
Faster serd_uri_serialise.
git-svn-id: http://svn.drobilla.net/serd/trunk@50 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/writer.c b/src/writer.c
index eca334a8..85d20deb 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -64,9 +64,9 @@ write_text(SerdWriter writer, TextContext ctx,
uint8_t in = utf8[i++];
switch (in) {
case '\\': writer->sink("\\\\", 2, writer->stream); continue;
- case '\n': writer->sink("\\n", 2, writer->stream); continue;
- case '\r': writer->sink("\\r", 2, writer->stream); continue;
- case '\t': writer->sink("\\t", 2, writer->stream); continue;
+ case '\n': writer->sink("\\n", 2, writer->stream); continue;
+ case '\r': writer->sink("\\r", 2, writer->stream); continue;
+ case '\t': writer->sink("\\t", 2, writer->stream); continue;
case '"':
if (terminator == '"') {
writer->sink("\\\"", 2, writer->stream);
@@ -86,7 +86,7 @@ write_text(SerdWriter writer, TextContext ctx,
if ((in & 0x80) == 0) { // Starts with `0'
size = 1;
c = in & 0x7F;
- if ((in >= 0x20) && (in <= 0x7E)) { // Printable ASCII
+ if (in_range((in >= 0x20) && (in <= 0x7E)) { // Printable ASCII
writer->sink(&in, 1, writer->stream);
continue;
}
@@ -112,6 +112,7 @@ write_text(SerdWriter writer, TextContext ctx,
if (ctx == WRITE_STRING && !(writer->style & SERD_STYLE_ASCII)) {
// Write UTF-8 character directly to UTF-8 output
+ // TODO: Scan to next escape and write entire range at once
writer->sink(utf8 + i - 1, size, writer->stream);
i += size - 1;
continue;