From 6eb1fa15a06ab7de08e33add1540a45b83c5f0d8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 11 Jul 2021 20:47:51 -0400 Subject: Add SerdWorld for shared library state --- src/reader.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/reader.c') diff --git a/src/reader.c b/src/reader.c index 25c4b3b1..c2c20b82 100644 --- a/src/reader.c +++ b/src/reader.c @@ -28,7 +28,7 @@ r_err(SerdReader* const reader, const SerdStatus st, const char* const fmt, ...) va_start(args, fmt); const Cursor* const cur = &reader->source.cur; const SerdError e = {st, cur->filename, cur->line, cur->col, fmt, &args}; - serd_error(reader->error_func, reader->error_handle, &e); + serd_error(reader->world, &e); va_end(args); return st; } @@ -144,7 +144,8 @@ serd_reader_read_document(SerdReader* const reader) } SerdReader* -serd_reader_new(const SerdSyntax syntax, +serd_reader_new(SerdWorld* const world, + const SerdSyntax syntax, const SerdSink* const sink, const size_t stack_size) { @@ -154,6 +155,7 @@ serd_reader_new(const SerdSyntax syntax, SerdReader* me = (SerdReader*)calloc(1, sizeof(SerdReader)); + me->world = world; me->sink = sink; me->default_graph = NULL; me->stack = serd_stack_new(stack_size); @@ -182,15 +184,6 @@ serd_reader_set_strict(SerdReader* const reader, const bool strict) reader->strict = strict; } -void -serd_reader_set_error_sink(SerdReader* const reader, - const SerdErrorFunc error_func, - void* const error_handle) -{ - reader->error_func = error_func; - reader->error_handle = error_handle; -} - void serd_reader_free(SerdReader* const reader) { -- cgit v1.2.1