From 930f28478ca2573b7f7baf29a57a03cfa95a841f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Dec 2023 01:20:48 -0500 Subject: Add a set of limits to the world The idea here is to remove the burden of passing things around like stack sizes (where most users don't care and will be happy with a reasonably large default) and keeping the call sites to things like serd_reader_new() clean. The cost is a bit more state, so it's both more powerful and more potentially flaky, since changing the limits has action at a distance that isn't clear from the call site. I think it's worth it for the cleaner API in the common case, and the much better forward compatibility. --- src/reader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/reader.c') diff --git a/src/reader.c b/src/reader.c index 61da89ff..4702131e 100644 --- a/src/reader.c +++ b/src/reader.c @@ -146,9 +146,9 @@ serd_reader_read_document(SerdReader* const reader) SerdReader* serd_reader_new(SerdWorld* const world, const SerdSyntax syntax, - const SerdSink* const sink, - const size_t stack_size) + const SerdSink* const sink) { + const size_t stack_size = world->limits.reader_stack_size; if (stack_size < 3 * sizeof(SerdNode) + 192 + serd_node_align) { return NULL; } -- cgit v1.2.1