From 0f9816d67bc67a396607291f845ca2a33c2285a7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 19 Dec 2022 17:55:02 -0500 Subject: Use ZixAllocator directly --- src/world.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/world.c') diff --git a/src/world.c b/src/world.c index b4fe4ebc..b160fc4e 100644 --- a/src/world.c +++ b/src/world.c @@ -4,13 +4,13 @@ #include "world.h" #include "log.h" -#include "memory.h" #include "namespaces.h" #include "node.h" #include "serd/node.h" #include "serd/status.h" #include "serd/world.h" +#include "zix/allocator.h" #include "zix/string_view.h" #include @@ -18,19 +18,15 @@ #include SerdWorld* -serd_world_new(SerdAllocator* const allocator) +serd_world_new(ZixAllocator* const allocator) { - SerdAllocator* const actual = - allocator ? allocator : serd_default_allocator(); - - SerdWorld* const world = - (SerdWorld*)serd_acalloc(actual, 1, sizeof(SerdWorld)); + ZixAllocator* const actual = allocator ? allocator : zix_default_allocator(); + SerdWorld* const world = (SerdWorld*)zix_calloc(actual, 1, sizeof(SerdWorld)); SerdNodes* const nodes = serd_nodes_new(actual); - if (!world || !nodes) { serd_nodes_free(nodes); - serd_afree(actual, world); + zix_free(actual, world); return NULL; } @@ -57,7 +53,7 @@ serd_world_new(SerdAllocator* const allocator) !(world->xsd_decimal = serd_nodes_get(nodes, serd_a_uri(xsd_decimal))) || !(world->xsd_integer = serd_nodes_get(nodes, serd_a_uri(xsd_integer)))) { serd_nodes_free(nodes); - serd_afree(actual, world); + zix_free(actual, world); return NULL; } @@ -72,7 +68,7 @@ serd_world_free(SerdWorld* const world) { if (world) { serd_nodes_free(world->nodes); - serd_afree(world->allocator, world); + zix_free(world->allocator, world); } } @@ -109,7 +105,7 @@ serd_world_get_blank(SerdWorld* const world) #undef BLANK_CHARS } -SerdAllocator* +ZixAllocator* serd_world_allocator(const SerdWorld* const world) { assert(world); -- cgit v1.2.1