aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/serd/writer.h5
-rw-r--r--src/serdi.c4
-rw-r--r--src/writer.c6
3 files changed, 6 insertions, 9 deletions
diff --git a/include/serd/writer.h b/include/serd/writer.h
index fabdcd61..3cd7e2f4 100644
--- a/include/serd/writer.h
+++ b/include/serd/writer.h
@@ -6,10 +6,10 @@
#include "serd/attributes.h"
#include "serd/env.h"
-#include "serd/node.h"
#include "serd/sink.h"
#include "serd/status.h"
#include "serd/stream.h"
+#include "serd/string_view.h"
#include "serd/syntax.h"
#include "serd/world.h"
#include "zix/attributes.h"
@@ -84,8 +84,7 @@ serd_writer_chop_blank_prefix(SerdWriter* ZIX_NONNULL writer,
it defaults to the base URI, so no up-references will be created at all.
*/
SERD_API SerdStatus
-serd_writer_set_root_uri(SerdWriter* ZIX_NONNULL writer,
- const SerdNode* ZIX_NULLABLE uri);
+serd_writer_set_root_uri(SerdWriter* ZIX_NONNULL writer, SerdStringView uri);
/**
Finish a write.
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);
}