Reworked, no version bump

This commit is contained in:
2026-08-12 19:47:59 -05:00
parent f82f8288cf
commit 70638a9b46
13 changed files with 1170 additions and 1383 deletions
+75
View File
@@ -0,0 +1,75 @@
/**
* @file internal.h
* @brief This header contains the definition of the internal allocator
* implementation and function pointers for the allocator virtual
* function table.
* @author John Christman (sorakatadzuma@gmail.com)
* @copyright Malunal Studios, LLC.
*/
#include "malunal/allocators.h"
#ifndef MALUNAL_ALLOCATORS_INTERNAL_HEADER
#define MALUNAL_ALLOCATORS_INTERNAL_HEADER
typedef allocation_error_t
(*allocator_initialize_pfn_t)(
allocator_mptr_t allocator,
allocator_mptr_t upstream,
malunal_size_t capacity
);
typedef allocation_error_t
(*allocator_finalize_pfn_t)(
allocator_mptr_t allocator
);
typedef allocation_result_t
(*allocator_acquire_pfn_t)(
allocator_mptr_t allocator,
malunal_size_t size
);
typedef allocation_result_t
(*allocator_reacquire_pfn_t)(
allocator_mptr_t allocator,
malunal_mptr_t address,
malunal_size_t oldsize,
malunal_size_t newsize
);
typedef allocation_error_t
(*allocator_release_pfn_t)(
allocator_mptr_t allocator,
malunal_mptr_t address,
malunal_size_t size
);
typedef struct {
allocator_initialize_pfn_t const initialize;
allocator_finalize_pfn_t const finalize;
allocator_acquire_pfn_t const acquire;
allocator_reacquire_pfn_t const reacquire;
allocator_release_pfn_t const release;
} virtual_table_t;
typedef virtual_table_t* vtable_mptr_t;
typedef const virtual_table_t* vtable_iptr_t;
typedef struct {
vtable_iptr_t const vtable;
allocator_mptr_t upstream;
malunal_mptr_t context;
malunal_size_t allocated;
malunal_size_t reserved;
malunal_size_t acquires;
malunal_size_t releases;
} implementation_t;
typedef implementation_t* impl_mptr_t;
typedef const implementation_t* impl_iptr_t;
#endif /* MALUNAL_ALLOCATORS_INTERNAL_HEADER */