diff options
author | David Robillard <d@drobilla.net> | 2021-10-27 14:15:31 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:24 -0500 |
commit | 30487c277ac5d4be5786733ca7b98adb4c810ae9 (patch) | |
tree | f1b00a7725d74a594fcd91de2aea924485356528 /src/describe.c | |
parent | 56cceb103dc633d6af957472945e792187a5dd4e (diff) | |
download | serd-30487c277ac5d4be5786733ca7b98adb4c810ae9.tar.gz serd-30487c277ac5d4be5786733ca7b98adb4c810ae9.tar.bz2 serd-30487c277ac5d4be5786733ca7b98adb4c810ae9.zip |
Add custom allocator support
Diffstat (limited to 'src/describe.c')
-rw-r--r-- | src/describe.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/describe.c b/src/describe.c index 695217fd..92750363 100644 --- a/src/describe.c +++ b/src/describe.c @@ -23,6 +23,7 @@ #define ZIX_HASH_RECORD_TYPE const SerdNode #include "serd/serd.h" +#include "zix/allocator.h" #include "zix/common.h" #include "zix/digest.h" #include "zix/hash.h" @@ -295,16 +296,18 @@ serd_describe_range(const SerdCursor* const range, assert(sink); - SerdStatus st = SERD_SUCCESS; - SerdCursor copy = *range; - ZixHash* const list_subjects = - zix_hash_new(NULL, identity, ptr_hash, ptr_equals); + SerdCursor copy = *range; - DescribeContext ctx = {range->model, sink, list_subjects, flags}; + ZixHash* const list_subjects = zix_hash_new( + (ZixAllocator*)range->model->allocator, identity, ptr_hash, ptr_equals); - st = write_pretty_range(&ctx, 0, ©, NULL, (flags & SERD_NO_TYPE_FIRST)); + SerdStatus st = SERD_BAD_ALLOC; + if (list_subjects) { + DescribeContext ctx = {range->model, sink, list_subjects, flags}; - zix_hash_free(list_subjects); + st = write_pretty_range(&ctx, 0, ©, NULL, (flags & SERD_NO_TYPE_FIRST)); + } + zix_hash_free(list_subjects); return st; } |