aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/n3.c21
-rw-r--r--src/reader.c9
-rw-r--r--src/writer.c1
-rw-r--r--tests/env_test.c1
4 files changed, 14 insertions, 18 deletions
diff --git a/src/n3.c b/src/n3.c
index 38e06fcb..637e728d 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -18,7 +18,6 @@
#include "node.h"
#include "reader.h"
#include "serd_internal.h"
-#include "sink.h"
#include "stack.h"
#include "string_utils.h"
#include "uri_utils.h"
@@ -1012,8 +1011,8 @@ read_anon(SerdReader* reader, ReadContext ctx, bool subject, SerdNode** dest)
*ctx.flags = old_flags;
}
- if (reader->sink->end && (!subject || !empty)) {
- reader->sink->end(reader->sink->handle, *dest);
+ if (!subject || !empty) {
+ serd_sink_write_end(reader->sink, *dest);
}
return (eat_byte_check(reader, ']') == ']') ? SERD_SUCCESS
@@ -1324,10 +1323,9 @@ read_base(SerdReader* reader, bool sparql, bool token)
SerdNode* uri = NULL;
TRY(st, read_IRIREF(reader, &uri));
- if (reader->sink->base) {
- serd_node_zero_pad(uri);
- TRY(st, reader->sink->base(reader->sink->handle, uri));
- }
+
+ serd_node_zero_pad(uri);
+ TRY(st, serd_sink_write_base(reader->sink, uri));
read_ws_star(reader);
if (!sparql) {
@@ -1363,11 +1361,10 @@ read_prefixID(SerdReader* reader, bool sparql, bool token)
SerdNode* uri = NULL;
TRY(st, read_IRIREF(reader, &uri));
- if (reader->sink->prefix) {
- serd_node_zero_pad(name);
- serd_node_zero_pad(uri);
- st = reader->sink->prefix(reader->sink->handle, name, uri);
- }
+ serd_node_zero_pad(name);
+ serd_node_zero_pad(uri);
+ st = serd_sink_write_prefix(reader->sink, name, uri);
+
if (!sparql) {
read_ws_star(reader);
st = eat_byte_check(reader, '.') ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX;
diff --git a/src/reader.c b/src/reader.c
index c855b7aa..a79073ee 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -18,7 +18,7 @@
#include "system.h"
#include "serd_internal.h"
-#include "sink.h"
+#include "stack.h"
#include "statement.h"
#include "world.h"
@@ -123,11 +123,8 @@ emit_statement(SerdReader* reader, ReadContext ctx, SerdNode* o)
&reader->source.cur
};
- const SerdStatus st = !reader->sink->statement
- ? SERD_SUCCESS
- : reader->sink->statement(reader->sink->handle,
- *ctx.flags,
- &statement);
+ const SerdStatus st =
+ serd_sink_write_statement(reader->sink, *ctx.flags, &statement);
*ctx.flags = 0;
return st;
diff --git a/src/writer.c b/src/writer.c
index 042d2bfe..d84600e1 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -16,6 +16,7 @@
#include "env.h"
#include "node.h"
+#include "serd_internal.h"
#include "sink.h"
#include "stack.h"
#include "string_utils.h"
diff --git a/tests/env_test.c b/tests/env_test.c
index b636048b..c0629da5 100644
--- a/tests/env_test.c
+++ b/tests/env_test.c
@@ -90,6 +90,7 @@ test_env(void)
serd_sink_set_prefix_func(count_prefixes_sink, count_prefixes);
serd_env_set_prefix(env, pre, eg);
serd_env_write_prefixes(env, count_prefixes_sink);
+ serd_sink_free(count_prefixes_sink);
assert(n_prefixes == 1);
SerdNode* shorter_uri = serd_new_uri("urn:foo");