diff options
author | David Robillard <d@drobilla.net> | 2021-02-20 20:10:57 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:06 -0500 |
commit | 1c1c060d7a449952051b2dd78176e48db53df1c4 (patch) | |
tree | 3f1a487c3fbdf87fa812c99bd5380325310e7b9f /include | |
parent | dd63c46261f36de5c6dbd951ae1c535128f5cf8c (diff) | |
download | serd-1c1c060d7a449952051b2dd78176e48db53df1c4.tar.gz serd-1c1c060d7a449952051b2dd78176e48db53df1c4.tar.bz2 serd-1c1c060d7a449952051b2dd78176e48db53df1c4.zip |
WIP: Make serd_env_expand() always return a node if it is not relative
The old interface was potentially faster, because it avoided unnecessary
copies, but was annoying to use and problematic because nodes that don't need
expansion were indistinguishable from nodes that failed to expand (like those
that use undefined namespace prefixes).
In the grand scheme of things, the potential performance improvement isn't
worth it, and unexpected unexpanded nodes causes deep nightmarish problems, so
just make serd_env_expand() copy the input if it doesn't need expansion to make
the API simpler and safer.
Diffstat (limited to 'include')
-rw-r--r-- | include/serd/serd.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index cfdc8693..a2e767ff 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -1062,13 +1062,15 @@ serd_env_qualify(const SerdEnv* SERD_NULLABLE env, const SerdNode* SERD_NONNULL uri); /** - Expand `node`, transforming CURIEs into URIs. + Expand `node`, transforming CURIEs and URI references into absolute URIs. If `node` is a relative URI reference, it is expanded to a full URI if possible. If `node` is a literal, its datatype is expanded if necessary. If `node` is a CURIE, it is expanded to a full URI if possible. - Returns null if `node` can not be expanded. + For simple nodes that do not require expansion, a copy is returned. Null is + returned if `node` is/contains a CURIE or relative URI that can not be + expanded. */ SERD_API SerdNode* SERD_ALLOCATED |