aboutsummaryrefslogtreecommitdiffstats
path: root/src/block_dumper.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-09-10 15:06:42 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit248a874d7425749d29cf900a1c3783c624ea8d8c (patch)
treeaed59f5a484a815cd254506866e98a947858904d /src/block_dumper.h
parent0bd10132c6707353dba80bd89cf0102ee7ca4e34 (diff)
downloadserd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.gz
serd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.bz2
serd-248a874d7425749d29cf900a1c3783c624ea8d8c.zip
Add support for custom allocators
This makes it explicit in the API where memory is allocated, and allows the user to provide a custom allocator to avoid the use of the default system allocator for whatever reason.
Diffstat (limited to 'src/block_dumper.h')
-rw-r--r--src/block_dumper.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/block_dumper.h b/src/block_dumper.h
index 24fb977c..e5a2c318 100644
--- a/src/block_dumper.h
+++ b/src/block_dumper.h
@@ -4,14 +4,18 @@
#ifndef SERD_SRC_BLOCK_DUMPER_H
#define SERD_SRC_BLOCK_DUMPER_H
+#include "serd/memory.h"
#include "serd/output_stream.h"
#include "serd/status.h"
+#include "serd/world.h"
#include "zix/attributes.h"
#include <stddef.h>
#include <string.h>
typedef struct {
+ SerdAllocator* ZIX_NONNULL allocator; ///< Buffer allocator
+
SerdOutputStream* ZIX_ALLOCATED out; ///< Output stream to write to
char* ZIX_ALLOCATED buf; ///< Local buffer if needed
size_t size; ///< Bytes pending for this block
@@ -25,7 +29,8 @@ typedef struct {
calling serd_block_dumper_close().
*/
SerdStatus
-serd_block_dumper_open(SerdBlockDumper* ZIX_NONNULL dumper,
+serd_block_dumper_open(const SerdWorld* ZIX_NONNULL world,
+ SerdBlockDumper* ZIX_NONNULL dumper,
SerdOutputStream* ZIX_NONNULL output,
size_t block_size);