diff options
author | David Robillard <d@drobilla.net> | 2021-07-11 20:47:51 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-13 23:03:46 -0500 |
commit | 71c950bb749c3581ab389edfff9771cb06242e29 (patch) | |
tree | a1437913131978133e48b21078d900859ce30c43 /src/writer.c | |
parent | 30f3e6fc2c1e24c429d5d0b7100dc449ade6703f (diff) | |
download | serd-71c950bb749c3581ab389edfff9771cb06242e29.tar.gz serd-71c950bb749c3581ab389edfff9771cb06242e29.tar.bz2 serd-71c950bb749c3581ab389edfff9771cb06242e29.zip |
Add SerdWorld for shared library state
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/writer.c b/src/writer.c index b132dc83..70d22485 100644 --- a/src/writer.c +++ b/src/writer.c @@ -93,6 +93,7 @@ static const SepRule rules[] = {{NULL, 0, 0, 0, 0}, {"\n", 1, 0, 1, 0}}; struct SerdWriterImpl { + SerdWorld* world; SerdSink iface; SerdSyntax syntax; SerdWriterFlags flags; @@ -101,8 +102,6 @@ struct SerdWriterImpl { SerdURIView root_uri; SerdStack anon_stack; SerdByteSink byte_sink; - SerdErrorFunc error_func; - void* error_handle; WriteContext context; SerdNode* list_subj; unsigned list_depth; @@ -149,8 +148,8 @@ w_err(SerdWriter* writer, SerdStatus st, const char* fmt, ...) va_list args; va_start(args, fmt); - const SerdError e = {st, "", 0, 0, fmt, &args}; - serd_error(writer->error_func, writer->error_handle, &e); + const SerdError e = {st, NULL, 0, 0, fmt, &args}; + serd_error(writer->world, &e); va_end(args); } @@ -948,7 +947,8 @@ serd_writer_finish(SerdWriter* writer) } SerdWriter* -serd_writer_new(SerdSyntax syntax, +serd_writer_new(SerdWorld* world, + SerdSyntax syntax, SerdWriterFlags flags, SerdEnv* env, SerdWriteFunc ssink, @@ -957,6 +957,7 @@ serd_writer_new(SerdSyntax syntax, const WriteContext context = WRITE_CONTEXT_NULL; SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter)); + writer->world = world; writer->syntax = syntax; writer->flags = flags; writer->env = env; @@ -979,15 +980,6 @@ serd_writer_new(SerdSyntax syntax, } void -serd_writer_set_error_sink(SerdWriter* writer, - SerdErrorFunc error_func, - void* error_handle) -{ - writer->error_func = error_func; - writer->error_handle = error_handle; -} - -void serd_writer_chop_blank_prefix(SerdWriter* writer, const char* prefix) { free(writer->bprefix); |