From 248a874d7425749d29cf900a1c3783c624ea8d8c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Sep 2023 15:06:42 -0400 Subject: 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. --- src/node.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/node.h') diff --git a/src/node.h b/src/node.h index a31085be..43368367 100644 --- a/src/node.h +++ b/src/node.h @@ -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 @@ -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 -- cgit v1.2.1