diff options
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c index dc41d522..7201c976 100644 --- a/src/writer.c +++ b/src/writer.c @@ -1330,6 +1330,8 @@ serd_writer_on_event(SerdWriter* writer, const SerdEvent* event) SerdStatus serd_writer_finish(SerdWriter* writer) { + assert(writer); + const SerdStatus st0 = terminate_context(writer); const SerdStatus st1 = serd_byte_sink_flush(&writer->byte_sink); @@ -1347,6 +1349,10 @@ serd_writer_new(SerdWorld* world, SerdWriteFunc ssink, void* stream) { + assert(world); + assert(env); + assert(ssink); + const size_t max_depth = world->limits.writer_max_depth; const WriteContext context = WRITE_CONTEXT_NULL; SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter)); @@ -1375,6 +1381,8 @@ serd_writer_new(SerdWorld* world, void serd_writer_chop_blank_prefix(SerdWriter* writer, const char* prefix) { + assert(writer); + free(writer->bprefix); writer->bprefix_len = 0; writer->bprefix = NULL; @@ -1390,6 +1398,8 @@ serd_writer_chop_blank_prefix(SerdWriter* writer, const char* prefix) SERD_NODISCARD static SerdStatus serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri) { + assert(writer); + if (uri && serd_node_type(uri) != SERD_URI) { return SERD_BAD_ARG; } @@ -1419,6 +1429,8 @@ serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri) SerdStatus serd_writer_set_root_uri(SerdWriter* writer, const SerdNode* uri) { + assert(writer); + serd_node_free(writer->root_node); writer->root_node = NULL; writer->root_uri = SERD_URI_NULL; @@ -1476,6 +1488,7 @@ serd_writer_free(SerdWriter* writer) const SerdSink* serd_writer_sink(SerdWriter* writer) { + assert(writer); return &writer->iface; } |