diff options
author | David Robillard <d@drobilla.net> | 2018-02-04 15:33:36 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | c644f404054e6d68f3bb645cf93b8ad1501b8938 (patch) | |
tree | 6291623c37dd9ef6be062113bf6ac5afa8115171 /src/serdi.c | |
parent | b0d4ae792c88cc55f9cc9a579530a1a13a158fda (diff) | |
download | serd-c644f404054e6d68f3bb645cf93b8ad1501b8938.tar.gz serd-c644f404054e6d68f3bb645cf93b8ad1501b8938.tar.bz2 serd-c644f404054e6d68f3bb645cf93b8ad1501b8938.zip |
Make nodes opaque
Diffstat (limited to 'src/serdi.c')
-rw-r--r-- | src/serdi.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/serdi.c b/src/serdi.c index 81ca35c5..afae904c 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -332,7 +332,7 @@ main(int argc, char** argv) input_syntax, output_syntax, ascii, bulk_write, full_uris, lax); SerdURIView base_uri = SERD_URI_NULL; - SerdNode base = SERD_NODE_NULL; + SerdNode* base = NULL; if (a < argc) { // Base URI given on command line base = serd_new_uri_from_string((const char*)argv[a], NULL, &base_uri); } else if (from_file && in_fd != stdin) { // Use input file URI @@ -340,10 +340,10 @@ main(int argc, char** argv) } FILE* const out_fd = stdout; - SerdEnv* const env = serd_env_new(&base); + SerdEnv* const env = serd_env_new(base); SerdWriter* const writer = serd_writer_new( - output_syntax, writer_flags, env, &base_uri, serd_file_sink, out_fd); + output_syntax, writer_flags, env, base, serd_file_sink, out_fd); SerdReader* const reader = serd_reader_new(input_syntax, @@ -360,10 +360,11 @@ main(int argc, char** argv) serd_writer_set_error_sink(writer, quiet_error_sink, NULL); } - SerdNode root = serd_node_from_string(SERD_URI, root_uri); - serd_writer_set_root_uri(writer, &root); + SerdNode* root = root_uri ? serd_new_string(SERD_URI, root_uri) : NULL; + serd_writer_set_root_uri(writer, root); serd_writer_chop_blank_prefix(writer, chop_prefix); serd_reader_add_blank_prefix(reader, add_prefix); + serd_node_free(root); SerdStatus st = SERD_SUCCESS; if (!from_file) { @@ -382,7 +383,7 @@ main(int argc, char** argv) serd_writer_finish(writer); serd_writer_free(writer); serd_env_free(env); - serd_node_free(&base); + serd_node_free(base); free(input_path); if (from_file) { |