aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-08-01 17:23:24 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit4cf33db925fbd8bea0defeb34e1ed6575349e644 (patch)
treea1654612a7e3e7450399af8bc59b9c58b9aa6577 /src
parent551faf54e35c757144204bf7a7949c0f7d0a20a3 (diff)
downloadserd-4cf33db925fbd8bea0defeb34e1ed6575349e644.tar.gz
serd-4cf33db925fbd8bea0defeb34e1ed6575349e644.tar.bz2
serd-4cf33db925fbd8bea0defeb34e1ed6575349e644.zip
Make serd_writer_set_root_uri() take a string view
This is generally more convenient, and the node was just being copied anyway.
Diffstat (limited to 'src')
-rw-r--r--src/serdi.c4
-rw-r--r--src/writer.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 42da9fd5..c03d3102 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -262,9 +262,7 @@ main(int argc, char** argv)
}
if (root_uri) {
- SerdNode* const root = serd_new_uri(serd_string(root_uri));
- serd_writer_set_root_uri(writer, root);
- serd_node_free(root);
+ serd_writer_set_root_uri(writer, serd_string(root_uri));
}
serd_writer_chop_blank_prefix(writer, chop_prefix);
diff --git a/src/writer.c b/src/writer.c
index c2008e2a..58700f6f 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -1425,7 +1425,7 @@ serd_writer_set_base_uri(SerdWriter* writer, const SerdNode* uri)
}
SerdStatus
-serd_writer_set_root_uri(SerdWriter* writer, const SerdNode* uri)
+serd_writer_set_root_uri(SerdWriter* writer, const SerdStringView uri)
{
assert(writer);
@@ -1433,8 +1433,8 @@ serd_writer_set_root_uri(SerdWriter* writer, const SerdNode* uri)
writer->root_node = NULL;
writer->root_uri = SERD_URI_NULL;
- if (uri) {
- writer->root_node = serd_node_copy(uri);
+ if (uri.length) {
+ writer->root_node = serd_new_uri(uri);
writer->root_uri = serd_node_uri_view(writer->root_node);
}