diff options
author | David Robillard <d@drobilla.net> | 2023-09-10 15:06:42 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 248a874d7425749d29cf900a1c3783c624ea8d8c (patch) | |
tree | aed59f5a484a815cd254506866e98a947858904d /src/node.h | |
parent | 0bd10132c6707353dba80bd89cf0102ee7ca4e34 (diff) | |
download | serd-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/node.h')
-rw-r--r-- | src/node.h | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -5,7 +5,9 @@ #define SERD_SRC_NODE_H #include "exess/exess.h" +#include "serd/memory.h" #include "serd/node.h" +#include "serd/status.h" #include "zix/attributes.h" #include <stdbool.h> @@ -46,10 +48,14 @@ serd_node_pattern_match(const SerdNode* ZIX_NULLABLE a, } SerdNode* ZIX_ALLOCATED -serd_node_malloc(size_t length, SerdNodeFlags flags, SerdNodeType type); +serd_node_malloc(SerdAllocator* ZIX_NULLABLE allocator, + size_t length, + SerdNodeFlags flags, + SerdNodeType type); -void -serd_node_set(SerdNode* ZIX_NONNULL* ZIX_NONNULL dst, +SerdStatus +serd_node_set(SerdAllocator* ZIX_NULLABLE allocator, + SerdNode* ZIX_NONNULL* ZIX_NONNULL dst, const SerdNode* ZIX_NONNULL src); ZIX_PURE_FUNC size_t |