diff options
author | David Robillard <d@drobilla.net> | 2020-11-12 20:52:23 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-13 01:15:05 +0100 |
commit | dddc46b13fa0379784c6369c656e37933ac623dc (patch) | |
tree | 31d09d623c11f49500b42e07566d066ab988dc59 /src | |
parent | febc0828f271aa06681081217ee3ab2649dbf13a (diff) | |
download | serd-dddc46b13fa0379784c6369c656e37933ac623dc.tar.gz serd-dddc46b13fa0379784c6369c656e37933ac623dc.tar.bz2 serd-dddc46b13fa0379784c6369c656e37933ac623dc.zip |
Allow setting the base URI of an Env to NULL
Diffstat (limited to 'src')
-rw-r--r-- | src/env.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |