diff options
author | David Robillard <d@drobilla.net> | 2020-08-12 20:54:05 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:59 +0100 |
commit | 7f1d50b40814db24573b9eb425566ce1d44d2e85 (patch) | |
tree | 56c87c5b0ed1b84027957888605e497d4521f0a0 /serd/serd.h | |
parent | aafc82f0bee3b222d395ef959aa4a6917f2ef0b2 (diff) | |
download | serd-7f1d50b40814db24573b9eb425566ce1d44d2e85.tar.gz serd-7f1d50b40814db24573b9eb425566ce1d44d2e85.tar.bz2 serd-7f1d50b40814db24573b9eb425566ce1d44d2e85.zip |
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 'serd/serd.h')
-rw-r--r-- | serd/serd.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/serd/serd.h b/serd/serd.h index 4dd7e7bd..d57dc00c 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -1123,11 +1123,13 @@ SerdNode* serd_env_qualify(const SerdEnv* env, const SerdNode* uri); /** - Expand `node`, transforming CURIEs into URIs + Expand `node`, transforming CURIEs and URI references into absolute URIs. If `node` is a literal, its datatype is expanded if necessary. - 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* |