diff options
author | David Robillard <d@drobilla.net> | 2020-11-12 20:18:47 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-13 01:15:05 +0100 |
commit | febc0828f271aa06681081217ee3ab2649dbf13a (patch) | |
tree | e4123cd6fdc68ba34170e897104824dabb01000c /src/system.h | |
parent | beed84b63136603600528c0f48bcf93f6cb51de4 (diff) | |
download | serd-febc0828f271aa06681081217ee3ab2649dbf13a.tar.gz serd-febc0828f271aa06681081217ee3ab2649dbf13a.tar.bz2 serd-febc0828f271aa06681081217ee3ab2649dbf13a.zip |
Use aligned allocation via C11 or Windows API where possible
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/system.h b/src/system.h index 0f6a0e0b..60095a5b 100644 --- a/src/system.h +++ b/src/system.h @@ -21,10 +21,19 @@ #include <stdio.h> -FILE* -serd_fopen(const char* path, const char* mode); +/// Open a file configured for fast sequential reading +FILE* serd_fopen(const char* path, const char* mode); -SERD_MALLOC_FUNC void* -serd_bufalloc(size_t size); +/// Allocate a buffer aligned to `alignment` bytes +SERD_MALLOC_FUNC void* serd_malloc_aligned(size_t alignment, size_t size); + +/// Allocate a zeroed buffer aligned to `alignment` bytes +SERD_MALLOC_FUNC void* serd_calloc_aligned(size_t alignment, size_t size); + +/// Allocate an aligned buffer for I/O +SERD_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_SYSTEM_H |