aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-03-03 01:19:42 +0000
committerDavid Robillard <d@drobilla.net>2013-03-03 01:19:42 +0000
commit48410222b75f72ec39aef69947a68cbef14329ee (patch)
tree66678c0f9f41aa75a66f1b7671db31735e30bbdf
parentca662173d1f59bc5cb94bfa77e4e0c2e710c2054 (diff)
downloadserd-48410222b75f72ec39aef69947a68cbef14329ee.tar.gz
serd-48410222b75f72ec39aef69947a68cbef14329ee.tar.bz2
serd-48410222b75f72ec39aef69947a68cbef14329ee.zip
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
-rw-r--r--src/writer.c13
1 files changed, 8 insertions, 5 deletions
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: