Reformat
This commit is contained in:
parent
8468bb8e28
commit
c90874ad10
@ -1,9 +1,9 @@
|
||||
#include "mem_allocator.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
/******************************************************************************
|
||||
**** Allocator API definitions
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Allocator API definitions
|
||||
/***************************************************************************/ //
|
||||
|
||||
void *wapp_mem_allocator_alloc(const Allocator *allocator, u64 size) {
|
||||
if (!allocator || !(allocator->alloc)) {
|
||||
|
@ -7,9 +7,9 @@
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/******************************************************************************
|
||||
**** Allocator function pointer types
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Allocator function pointer types
|
||||
/***************************************************************************/ //
|
||||
|
||||
typedef void *(MemAllocFunc)(u64 size, void *alloc_obj);
|
||||
typedef void *(MemAllocAlignedFunc)(u64 size, u64 alignment, void *alloc_obj);
|
||||
@ -20,9 +20,9 @@ typedef void(MemFreeFunc)(void **ptr, void *alloc_obj);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
**** Allocator type
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Allocator type
|
||||
/***************************************************************************/ //
|
||||
|
||||
typedef struct allocator Allocator;
|
||||
struct allocator {
|
||||
@ -36,9 +36,9 @@ struct allocator {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
**** Allocator API declarations
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Allocator API declarations
|
||||
/***************************************************************************/ //
|
||||
|
||||
void *wapp_mem_allocator_alloc(const Allocator *allocator, u64 size);
|
||||
void *wapp_mem_allocator_alloc_aligned(const Allocator *allocator, u64 size,
|
||||
|
@ -24,9 +24,9 @@ struct arena {
|
||||
#endif // ifdef WAPP_PLATFORM_WINDOWS
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena API definitions
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena API definitions
|
||||
/***************************************************************************/ //
|
||||
|
||||
bool wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity,
|
||||
MemAllocFlags flags, bool zero_buffer) {
|
||||
|
@ -11,9 +11,9 @@ extern "C" {
|
||||
|
||||
typedef struct arena Arena;
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena wrapper macros
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena wrapper macros
|
||||
/***************************************************************************/ //
|
||||
|
||||
#define wapp_mem_arena_init(arena_dptr, base_capacity) \
|
||||
(wapp_mem_arena_init_custom(arena_dptr, base_capacity, \
|
||||
@ -32,9 +32,9 @@ typedef struct arena Arena;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena API declarations
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena API declarations
|
||||
/***************************************************************************/ //
|
||||
|
||||
/**
|
||||
* Arena initialisation function. `wapp_mem_arena_init_custom` provides the most
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "mem_arena_allocator.h"
|
||||
#include "mem_arena.h"
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena Allocator wrappers declarations
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena Allocator wrappers declarations
|
||||
/***************************************************************************/ //
|
||||
|
||||
internal inline void *mem_arena_alloc(u64 size, void *alloc_obj);
|
||||
internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment,
|
||||
@ -11,9 +11,9 @@ internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena Allocator API definitions
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena Allocator API definitions
|
||||
/***************************************************************************/ //
|
||||
|
||||
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity,
|
||||
MemAllocFlags flags,
|
||||
@ -42,9 +42,9 @@ void wapp_mem_arena_allocator_destroy(Allocator *allocator) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena Allocator wrappers definitions
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena Allocator wrappers definitions
|
||||
/***************************************************************************/ //
|
||||
|
||||
internal inline void *mem_arena_alloc(u64 size, void *alloc_obj) {
|
||||
Arena *arena = (Arena *)alloc_obj;
|
||||
|
@ -10,9 +10,9 @@
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena Allocator wrapper macros
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena Allocator wrapper macros
|
||||
/***************************************************************************/ //
|
||||
|
||||
#define wapp_mem_arena_allocator_init(base_capacity) \
|
||||
(wapp_mem_arena_allocator_init_custom(base_capacity, WAPP_MEM_ALLOC_RESERVE, \
|
||||
@ -29,9 +29,9 @@ extern "C" {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
**** Arena Allocator API declarations
|
||||
***************************************************************************///
|
||||
/***************************************************************************/ //
|
||||
////// Arena Allocator API declarations
|
||||
/***************************************************************************/ //
|
||||
|
||||
/**
|
||||
* Wraps an Arena in an Allocator object. It attempts to initialise the Arena
|
||||
|
Loading…
Reference in New Issue
Block a user