From c2e59da8865a8c5719b8ddaf5f68204729a8ebab Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 1 Mar 2021 19:38:01 -0500 Subject: Add SerdSink interface and hide implementations --- src/n3.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/n3.c') diff --git a/src/n3.c b/src/n3.c index 929b1a97..cd7e5a03 100644 --- a/src/n3.c +++ b/src/n3.c @@ -11,6 +11,7 @@ #include "serd/node.h" #include "serd/reader.h" +#include "serd/sink.h" #include "serd/statement.h" #include "serd/status.h" #include "serd/syntax.h" @@ -1099,9 +1100,7 @@ read_anon(SerdReader* const reader, return r_err(reader, SERD_BAD_SYNTAX, "'.' inside blank\n"); } read_ws_star(reader); - if (reader->end_func) { - reader->end_func(reader->handle, deref(reader, *dest)); - } + serd_sink_write_end(reader->sink, deref(reader, *dest)); *ctx.flags = old_flags; } @@ -1453,9 +1452,7 @@ read_base(SerdReader* const reader, const bool sparql, const bool token) Ref uri = 0; TRY(st, read_IRIREF(reader, &uri)); - if (reader->base_func) { - TRY(st, reader->base_func(reader->handle, deref(reader, uri))); - } + TRY(st, serd_sink_write_base(reader->sink, deref(reader, uri))); pop_node(reader, uri); read_ws_star(reader); @@ -1491,10 +1488,8 @@ read_prefixID(SerdReader* const reader, const bool sparql, const bool token) Ref uri = 0; TRY(st, read_IRIREF(reader, &uri)); - if (reader->prefix_func) { - st = reader->prefix_func( - reader->handle, deref(reader, name), deref(reader, uri)); - } + st = serd_sink_write_prefix( + reader->sink, deref(reader, name), deref(reader, uri)); pop_node(reader, uri); pop_node(reader, name); @@ -1502,7 +1497,6 @@ read_prefixID(SerdReader* const reader, const bool sparql, const bool token) read_ws_star(reader); st = eat_byte_check(reader, '.') ? SERD_SUCCESS : SERD_BAD_SYNTAX; } - return st; } -- cgit v1.2.1