aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-21 00:24:59 +0000
committerDavid Robillard <d@drobilla.net>2012-02-21 00:24:59 +0000
commitae46d9dfd96b05ddf876465f2c5a8cdd5f742ab0 (patch)
treef9e8eb6bb20e9b6b125005d93106466df9cae0bc /src/writer.c
parent3b8b0a4732ce3122c229f7a3d327a0f916255e97 (diff)
downloadserd-ae46d9dfd96b05ddf876465f2c5a8cdd5f742ab0.tar.gz
serd-ae46d9dfd96b05ddf876465f2c5a8cdd5f742ab0.tar.bz2
serd-ae46d9dfd96b05ddf876465f2c5a8cdd5f742ab0.zip
Print command name in serdi error messages.
Trim code. git-svn-id: http://svn.drobilla.net/serd/trunk@313 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/writer.c b/src/writer.c
index 03ba9781..270bd16f 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -269,7 +269,7 @@ write_sep(SerdWriter* writer, const Sep sep)
writer->last_sep = sep;
}
-static void
+static SerdStatus
reset_context(SerdWriter* writer, bool del)
{
if (del) {
@@ -283,6 +283,7 @@ reset_context(SerdWriter* writer, bool del)
writer->context.predicate.type = SERD_NOTHING;
}
writer->empty = false;
+ return SERD_SUCCESS;
}
typedef enum {
@@ -625,8 +626,7 @@ serd_writer_finish(SerdWriter* writer)
if (writer->style & SERD_STYLE_BULK) {
serd_bulk_sink_flush(&writer->bulk_sink);
}
- reset_context(writer, true);
- return SERD_SUCCESS;
+ return reset_context(writer, true);
}
SERD_API
@@ -693,8 +693,7 @@ serd_writer_set_base_uri(SerdWriter* writer,
sink(uri->buf, uri->n_bytes, writer);
sink("> .\n", 4, writer);
}
- reset_context(writer, false);
- return SERD_SUCCESS;
+ return reset_context(writer, false);
}
return SERD_ERR_UNKNOWN;
}
@@ -717,8 +716,7 @@ serd_writer_set_prefix(SerdWriter* writer,
write_text(writer, WRITE_URI, uri->buf, uri->n_bytes, '>');
sink("> .\n", 4, writer);
}
- reset_context(writer, false);
- return SERD_SUCCESS;
+ return reset_context(writer, false);
}
return SERD_ERR_UNKNOWN;
}
@@ -740,7 +738,5 @@ SERD_API
size_t
serd_file_sink(const void* buf, size_t len, void* stream)
{
- FILE* file = (FILE*)stream;
- return fwrite(buf, 1, len, file);
+ return fwrite(buf, 1, len, (FILE*)stream);
}
-