From 2b775031fc4d239cbece7f0911f4be9e50e690d7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 29 Dec 2018 17:36:15 -0500 Subject: Add Env to Sink This isn't technically necessary for any sink, but is a pattern common to every sink implementation in serd, so having it here reduces boilerplate and parameters in user code. --- tests/overflow_test.c | 2 +- tests/read_chunk_test.c | 2 +- tests/serd_test.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/overflow_test.c b/tests/overflow_test.c index 1614a2db..43be9932 100644 --- a/tests/overflow_test.c +++ b/tests/overflow_test.c @@ -56,7 +56,7 @@ main(void) {NULL, 0}}; SerdWorld* world = serd_world_new(); - SerdSink* sink = serd_sink_new(NULL); + SerdSink* sink = serd_sink_new(NULL, NULL); for (const Test* t = tests; t->str; ++t) { const SerdStatus st = test(world, sink, t->str, t->stack_size); diff --git a/tests/read_chunk_test.c b/tests/read_chunk_test.c index 75750b8b..54513f06 100644 --- a/tests/read_chunk_test.c +++ b/tests/read_chunk_test.c @@ -74,7 +74,7 @@ int main(void) { SerdWorld* world = serd_world_new(); - SerdSink* sink = serd_sink_new(NULL); + SerdSink* sink = serd_sink_new(NULL, NULL); serd_sink_set_base_func(sink, on_base); serd_sink_set_prefix_func(sink, on_prefix); serd_sink_set_statement_func(sink, on_statement); diff --git a/tests/serd_test.c b/tests/serd_test.c index a461e22a..f923a9c0 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -452,10 +452,11 @@ main(void) assert(serd_env_set_prefix(env, b, lit)); size_t n_prefixes = 0; - SerdSink* count_prefixes_sink = serd_sink_new(&n_prefixes); + SerdSink* count_prefixes_sink = serd_sink_new(&n_prefixes, NULL); 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"); @@ -601,7 +602,7 @@ main(void) fseek(fd, 0, SEEK_SET); size_t n_statements = 0; - SerdSink* sink = serd_sink_new(&n_statements); + SerdSink* sink = serd_sink_new(&n_statements, NULL); serd_sink_set_statement_func(sink, count_statements); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); -- cgit v1.2.1