aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-13 19:30:45 +0100
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:05 -0500
commit10c706a040abeaf5c82db54086d4edb03a995cf3 (patch)
treea9eec56499e1f2cb90a623267b9be4d1453ce99e /src/writer.c
parent024553949ab66abdea597bed386b2f36018df337 (diff)
downloadserd-10c706a040abeaf5c82db54086d4edb03a995cf3.tar.gz
serd-10c706a040abeaf5c82db54086d4edb03a995cf3.tar.bz2
serd-10c706a040abeaf5c82db54086d4edb03a995cf3.zip
Add SerdWorld for shared library state
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/writer.c b/src/writer.c
index 5a934e41..de0e80a7 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;
@@ -149,8 +150,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);
}
@@ -966,7 +967,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,
@@ -975,6 +977,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;
@@ -997,15 +1000,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);