diff options
-rw-r--r-- | src/env.c | 16 | ||||
-rw-r--r-- | src/reader.c | 5 | ||||
-rw-r--r-- | src/string.c | 2 | ||||
-rw-r--r-- | src/uri.c | 3 | ||||
-rw-r--r-- | src/writer.c | 9 |
5 files changed, 32 insertions, 3 deletions
@@ -140,6 +140,8 @@ serd_env_set_prefix(SerdEnv* const env, const SerdNode* const uri) { assert(env); + assert(name); + assert(uri); if (!name->buf || uri->type != SERD_URI) { return SERD_ERR_BAD_ARG; @@ -167,6 +169,10 @@ serd_env_set_prefix_from_strings(SerdEnv* const env, const uint8_t* const name, const uint8_t* const uri) { + assert(env); + assert(name); + assert(uri); + const SerdNode name_node = serd_node_from_string(SERD_LITERAL, name); const SerdNode uri_node = serd_node_from_string(SERD_URI, uri); @@ -179,6 +185,10 @@ serd_env_qualify(const SerdEnv* const env, SerdNode* const prefix, SerdChunk* const suffix) { + assert(uri); + assert(prefix); + assert(suffix); + if (!env) { return false; } @@ -205,6 +215,10 @@ serd_env_expand(const SerdEnv* const env, SerdChunk* const uri_prefix, SerdChunk* const uri_suffix) { + assert(curie); + assert(uri_prefix); + assert(uri_suffix); + if (!env) { return SERD_ERR_BAD_CURIE; } @@ -230,6 +244,8 @@ serd_env_expand(const SerdEnv* const env, SerdNode serd_env_expand_node(const SerdEnv* const env, const SerdNode* const node) { + assert(node); + if (!env) { return SERD_NODE_NULL; } diff --git a/src/reader.c b/src/reader.c index 1936808a..aa24a9ca 100644 --- a/src/reader.c +++ b/src/reader.c @@ -200,6 +200,7 @@ serd_reader_new(const SerdSyntax syntax, void serd_reader_set_strict(SerdReader* const reader, const bool strict) { + assert(reader); reader->strict = strict; } @@ -208,6 +209,7 @@ serd_reader_set_error_sink(SerdReader* const reader, const SerdErrorSink error_sink, void* const error_handle) { + assert(reader); reader->error_sink = error_sink; reader->error_handle = error_handle; } @@ -392,6 +394,9 @@ serd_reader_read_file_handle(SerdReader* const reader, FILE* const file, const uint8_t* const name) { + assert(reader); + assert(file); + return serd_reader_read_source(reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, diff --git a/src/string.c b/src/string.c index 52fb4a91..b2946aac 100644 --- a/src/string.c +++ b/src/string.c @@ -91,6 +91,8 @@ serd_strlen(const uint8_t* const str, size_t* const n_bytes, SerdNodeFlags* const flags) { + assert(str); + size_t n_chars = 0; size_t i = 0; SerdNodeFlags f = 0; @@ -430,7 +430,6 @@ serd_uri_serialise_relative(const SerdURI* const uri, { assert(uri); assert(sink); - assert(stream); size_t len = 0; const bool relative = @@ -484,7 +483,7 @@ serd_uri_serialise_relative(const SerdURI* const uri, size_t serd_uri_serialise(const SerdURI* const uri, SerdSink sink, void* const stream) { + assert(uri); assert(sink); - assert(stream); return serd_uri_serialise_relative(uri, NULL, NULL, sink, stream); } diff --git a/src/writer.c b/src/writer.c index 58d7e64f..2b127d04 100644 --- a/src/writer.c +++ b/src/writer.c @@ -946,6 +946,9 @@ serd_writer_write_statement(SerdWriter* writer, const SerdNode* lang) { assert(writer); + assert(subject); + assert(predicate); + assert(object); SerdStatus st = SERD_SUCCESS; @@ -1145,7 +1148,7 @@ serd_writer_new(SerdSyntax syntax, void* stream) { assert(env); - assert(sink); + assert(ssink); const WriteContext context = WRITE_CONTEXT_NULL; SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter)); @@ -1239,6 +1242,10 @@ serd_writer_set_prefix(SerdWriter* writer, const SerdNode* name, const SerdNode* uri) { + assert(writer); + assert(name); + assert(uri); + SerdStatus st = SERD_SUCCESS; TRY(st, serd_env_set_prefix(writer->env, name, uri)); |