From 7ffa2c0488fcd96c3c12713e5650633eb03e91f7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 27 Mar 2023 05:39:26 -0400 Subject: [WIP] Move SerdEnv mutation from writer to reader Writing having side-effects seems questionable in general, and this prepares things for expanding URIs in the reader. --- tools/serd-pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c index 734d02f4..8bf26f2a 100644 --- a/tools/serd-pipe.c +++ b/tools/serd-pipe.c @@ -72,6 +72,7 @@ static SerdStatus read_file(SerdWorld* const world, const SerdSyntax syntax, const SerdReaderFlags flags, + SerdEnv* const env, const SerdSink* const sink, const size_t stack_size, const char* const filename, @@ -86,12 +87,10 @@ read_file(SerdWorld* const world, return SERD_BAD_STREAM; } - SerdLimits limits = serd_world_limits(world); - limits.reader_stack_size = stack_size; + const SerdLimits limits = {stack_size, MAX_DEPTH}; serd_world_set_limits(world, limits); - SerdReader* reader = serd_reader_new(world, syntax, flags, sink); - + SerdReader* reader = serd_reader_new(world, syntax, flags, env, sink); serd_reader_add_blank_prefix(reader, add_prefix); SerdStatus st = serd_reader_start(reader, &in, NULL, block_size); @@ -315,6 +314,7 @@ main(int argc, char** argv) serd_reader_new(world, input_syntax ? input_syntax : SERD_TRIG, reader_flags, + env, serd_writer_sink(writer)); serd_reader_add_blank_prefix(reader, add_prefix); @@ -349,6 +349,7 @@ main(int argc, char** argv) if ((st = read_file(world, serd_choose_syntax(world, input_syntax, inputs[i]), reader_flags, + env, serd_writer_sink(writer), stack_size, inputs[i], -- cgit v1.2.1