From aa6b5ec5b9344bce0ea38d294aef0782c3745548 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 2 Oct 2022 14:47:14 -0400 Subject: Add assertions for all non-null pointers in the public API --- src/env.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/env.c') diff --git a/src/env.c b/src/env.c index 8f37ffa4..b0f652c3 100644 --- a/src/env.c +++ b/src/env.c @@ -115,6 +115,8 @@ serd_env_base_uri(const SerdEnv* const env) SerdStatus serd_env_set_base_uri(SerdEnv* const env, const SerdStringView uri) { + assert(env); + if (!uri.length) { serd_node_free(env->base_uri_node); env->base_uri_node = NULL; @@ -179,6 +181,8 @@ serd_env_set_prefix(SerdEnv* const env, const SerdStringView name, const SerdStringView uri) { + assert(env); + if (serd_uri_string_has_scheme(uri.data)) { // Set prefix to absolute URI serd_env_add(env, name, uri); @@ -323,6 +327,9 @@ serd_env_expand(const SerdEnv* env, const SerdNode* node) SerdStatus serd_env_write_prefixes(const SerdEnv* const env, const SerdSink* const sink) { + assert(env); + assert(sink); + SerdStatus st = SERD_SUCCESS; for (size_t i = 0; !st && i < env->n_prefixes; ++i) { -- cgit v1.2.1