From dddc46b13fa0379784c6369c656e37933ac623dc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Nov 2020 20:52:23 +0100 Subject: Allow setting the base URI of an Env to NULL --- src/env.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/env.c b/src/env.c index 431fef41..ac081ee0 100644 --- a/src/env.c +++ b/src/env.c @@ -70,13 +70,17 @@ serd_env_get_base_uri(const SerdEnv* env, return &env->base_uri_node; } -// TODO: Make env nonnull in next major release SerdStatus serd_env_set_base_uri(SerdEnv* env, const SerdNode* uri) { - if (!env || !uri) { + if (!env || (uri && uri->type != SERD_URI)) { return SERD_ERR_BAD_ARG; + } else if (!uri) { + serd_node_free(&env->base_uri_node); + env->base_uri_node = SERD_NODE_NULL; + env->base_uri = SERD_URI_NULL; + return SERD_SUCCESS; } // Resolve base URI and create a new node and URI for it -- cgit v1.2.1