diff options
author | David Robillard <d@drobilla.net> | 2021-01-13 19:34:11 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:05 -0500 |
commit | 2e25fe1e64f487fd91ff6f636bf3249b761ffcdc (patch) | |
tree | 73dc6d1731442acd26ea5b1f11de000c8dd31967 /src/writer.c | |
parent | e6abc21f9bde66d8f60078493354ba3713f9fcd8 (diff) | |
download | serd-2e25fe1e64f487fd91ff6f636bf3249b761ffcdc.tar.gz serd-2e25fe1e64f487fd91ff6f636bf3249b761ffcdc.tar.bz2 serd-2e25fe1e64f487fd91ff6f636bf3249b761ffcdc.zip |
Use a fixed-size reader stack
This improves performance, and makes the reader more suitable for embedded or
network-facing applications, at the cost of requiring the user to specify a
maximum stack size.
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/writer.c b/src/writer.c index 2b2d5ed8..5a934e41 100644 --- a/src/writer.c +++ b/src/writer.c @@ -906,6 +906,10 @@ serd_writer_write_statement(SerdWriter* writer, if (flags & (SERD_ANON_S_BEGIN | SERD_ANON_O_BEGIN)) { WriteContext* ctx = (WriteContext*)serd_stack_push(&writer->anon_stack, sizeof(WriteContext)); + if (!ctx) { + return SERD_ERR_OVERFLOW; + } + *ctx = writer->context; WriteContext new_context = { serd_node_copy(graph), serd_node_copy(subject), NULL}; @@ -976,7 +980,7 @@ serd_writer_new(SerdSyntax syntax, writer->env = env; writer->root_node = NULL; writer->root_uri = SERD_URI_NULL; - writer->anon_stack = serd_stack_new(4 * sizeof(WriteContext)); + writer->anon_stack = serd_stack_new(SERD_PAGE_SIZE); writer->context = context; writer->list_subj = NULL; writer->empty = true; |