aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c
index 5416d144..e73533e7 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -1268,6 +1268,8 @@ serd_writer_write_node(SerdWriter* writer, const SerdNode* node)
SerdStatus
serd_writer_finish(SerdWriter* writer)
{
+ assert(writer);
+
SerdStatus st = SERD_SUCCESS;
if (ctx(writer, SERD_SUBJECT)) {
st = write_sep(writer, writer->context.flags, SEP_END_S);
@@ -1296,6 +1298,10 @@ serd_writer_new(SerdWorld* world,
const SerdEnv* env,
SerdByteSink* byte_sink)
{
+ assert(world);
+ assert(env);
+ assert(byte_sink);
+
const WriteContext context = WRITE_CONTEXT_NULL;
SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter));
@@ -1321,6 +1327,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;
@@ -1336,6 +1344,8 @@ serd_writer_chop_blank_prefix(SerdWriter* writer, const char* prefix)
SerdStatus
serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri)
{
+ assert(writer);
+
if (uri->type != SERD_URI) {
return SERD_ERR_BAD_ARG;
}
@@ -1362,6 +1372,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;
@@ -1421,6 +1433,7 @@ serd_writer_free(SerdWriter* writer)
const SerdSink*
serd_writer_sink(SerdWriter* writer)
{
+ assert(writer);
return &writer->iface;
}
@@ -1430,7 +1443,10 @@ serd_buffer_sink(const void* const buf,
const size_t nmemb,
void* const stream)
{
+ assert(buf);
assert(size == 1);
+ assert(stream);
+
(void)size;
SerdBuffer* buffer = (SerdBuffer*)stream;
@@ -1443,6 +1459,8 @@ serd_buffer_sink(const void* const buf,
char*
serd_buffer_sink_finish(SerdBuffer* const stream)
{
+ assert(stream);
+
serd_buffer_sink("", 1, 1, stream);
return (char*)stream->buf;
}