diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/reader.c | 9 | ||||
-rw-r--r-- | src/serdi.c | 9 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/reader.c b/src/reader.c index f45e9e0d..e819d472 100644 --- a/src/reader.c +++ b/src/reader.c @@ -161,6 +161,7 @@ serd_reader_read_document(SerdReader* const reader) SerdReader* serd_reader_new(SerdWorld* const world, const SerdSyntax syntax, + const SerdReaderFlags flags, const SerdSink* const sink) { const size_t stack_size = world->limits.reader_stack_size; @@ -175,7 +176,7 @@ serd_reader_new(SerdWorld* const world, me->stack = serd_stack_new(stack_size); me->syntax = syntax; me->next_id = 1; - me->strict = true; + me->strict = !(flags & SERD_READ_LAX); // Reserve a bit of space at the end of the stack to zero pad nodes me->stack.buf_size -= serd_node_align; @@ -193,12 +194,6 @@ serd_reader_new(SerdWorld* const world, } void -serd_reader_set_strict(SerdReader* const reader, const bool strict) -{ - reader->strict = strict; -} - -void serd_reader_free(SerdReader* const reader) { if (!reader) { diff --git a/src/serdi.c b/src/serdi.c index 8a4a52cf..42da9fd5 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -102,11 +102,11 @@ main(int argc, char** argv) SerdSyntax input_syntax = SERD_SYNTAX_EMPTY; SerdSyntax output_syntax = SERD_SYNTAX_EMPTY; + SerdReaderFlags reader_flags = 0; SerdWriterFlags writer_flags = 0; bool from_string = false; bool from_stdin = false; bool bulk_read = true; - bool lax = false; bool osyntax_set = false; bool quiet = false; size_t stack_size = 1048576U; @@ -142,8 +142,8 @@ main(int argc, char** argv) } else if (opt == 'h') { return print_usage(prog, false); } else if (opt == 'l') { + reader_flags |= SERD_READ_LAX; writer_flags |= SERD_WRITE_LAX; - lax = true; } else if (opt == 'q') { quiet = true; } else if (opt == 't') { @@ -254,10 +254,9 @@ main(int argc, char** argv) const SerdLimits limits = {stack_size, MAX_DEPTH}; serd_world_set_limits(world, limits); - SerdReader* const reader = - serd_reader_new(world, input_syntax, serd_writer_sink(writer)); + SerdReader* const reader = serd_reader_new( + world, input_syntax, reader_flags, serd_writer_sink(writer)); - serd_reader_set_strict(reader, !lax); if (quiet) { serd_world_set_error_func(world, quiet_error_func, NULL); } |