From 48410222b75f72ec39aef69947a68cbef14329ee Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 3 Mar 2013 01:19:42 +0000 Subject: Pass turtle-syntax-bad-prefix-01 (propagate errors in write_node). git-svn-id: http://svn.drobilla.net/serd/trunk@424 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- src/writer.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/writer.c b/src/writer.c index 75af4b57..3c94d087 100644 --- a/src/writer.c +++ b/src/writer.c @@ -562,15 +562,18 @@ serd_writer_write_statement(SerdWriter* writer, return SERD_ERR_BAD_ARG; } +#define TRY(write_result) \ + if (!write_result) { \ + return SERD_ERR_UNKNOWN; \ + } + switch (writer->syntax) { case SERD_NTRIPLES: - write_node(writer, subject, NULL, NULL, FIELD_SUBJECT, flags); + TRY(write_node(writer, subject, NULL, NULL, FIELD_SUBJECT, flags)); sink(" ", 1, writer); - write_node(writer, predicate, NULL, NULL, FIELD_PREDICATE, flags); + TRY(write_node(writer, predicate, NULL, NULL, FIELD_PREDICATE, flags)); sink(" ", 1, writer); - if (!write_node(writer, object, datatype, lang, FIELD_OBJECT, flags)) { - return SERD_ERR_UNKNOWN; - } + TRY(write_node(writer, object, datatype, lang, FIELD_OBJECT, flags)); sink(" .\n", 3, writer); return SERD_SUCCESS; default: -- cgit v1.2.1