diff options
author | David Robillard <d@drobilla.net> | 2023-09-10 15:06:42 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 248a874d7425749d29cf900a1c3783c624ea8d8c (patch) | |
tree | aed59f5a484a815cd254506866e98a947858904d /src/system.h | |
parent | 0bd10132c6707353dba80bd89cf0102ee7ca4e34 (diff) | |
download | serd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.gz serd-248a874d7425749d29cf900a1c3783c624ea8d8c.tar.bz2 serd-248a874d7425749d29cf900a1c3783c624ea8d8c.zip |
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.
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/system.h b/src/system.h index a0ec05dc..b606744b 100644 --- a/src/system.h +++ b/src/system.h @@ -4,9 +4,7 @@ #ifndef SERD_SRC_SYSTEM_H #define SERD_SRC_SYSTEM_H -#include "zix/attributes.h" - -#include <stdio.h> +#include <stddef.h> #define SERD_PAGE_SIZE 4096 @@ -14,20 +12,4 @@ int serd_system_strerror(int errnum, char* buf, size_t buflen); -/// Allocate a buffer aligned to `alignment` bytes -ZIX_MALLOC_FUNC void* -serd_malloc_aligned(size_t alignment, size_t size); - -/// Allocate a zeroed buffer aligned to `alignment` bytes -ZIX_MALLOC_FUNC void* -serd_calloc_aligned(size_t alignment, size_t size); - -/// Allocate an aligned buffer for I/O -ZIX_MALLOC_FUNC void* -serd_allocate_buffer(size_t size); - -/// Free a buffer allocated with an aligned allocation function -void -serd_free_aligned(void* ptr); - #endif // SERD_SRC_SYSTEM_H |