aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_sink.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-28Simplify output stream APIDavid Robillard1-124/+0
This makes the paging mechanism an internal detail once again. While it's conceptually elegant to simply have a single write interface and have the block dumper just be another implementation of that, unfortunately it is not practical. The inlining of serd_block_dumper_write() is a significant performance boost, because it avoids a non-inlinable function call of overhead per character. Compared to the SerdByteSink approach, this removes the burden and overhead of needing to dynamically allocate the structure itself.
2022-01-28Provide a full output stream implementation for SerdBufferDavid Robillard1-9/+1
Essentially replaces serd_buffer_sink_finish() with serd_buffer_close(), which makes writing to a buffer consistent with writing to a file or anything else.
2022-01-28Add a close function to SerdByteSinkDavid Robillard1-31/+26
This simplifies everything by replacing special cases with a more general close function. A type is no longer stored in the structure, so the other constructors are now essentially syntactic sugar for the universal serd_byte_sink_new_function().
2022-01-28Add assertions for all non-null pointers in the public APIDavid Robillard1-0/+11
Clang issues warnings at build time based on the SERD_NONNULL annotations, which is a much better approach in general. However, it does not cover cases where the API is being used with another compiler, or without a compiler that can statically check things at all (such as Python or other dynamic language bindings). In those situations, getting a clear assertion message is a lot less confusing than a random crash somewhere in serd, and it makes it clear that the bug is in the caller, so I think it's worth the tedious verbosity.
2022-01-13Make Writer always write to a ByteSinkDavid Robillard1-44/+64
2022-01-13Expose SerdByteSink in public APIDavid Robillard1-0/+106