diff options
author | David Robillard <d@drobilla.net> | 2019-04-09 10:28:59 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-06-21 18:12:04 +0200 |
commit | ff7d07e560eb32c9c10d41d25a7b8ea4cfdf7f69 (patch) | |
tree | 943514c868285e02c45d821c5a77c5dc153cd39a /src/system.h | |
parent | 1e299f9f1f9cd621d98a1bae86047a28de9c24f6 (diff) | |
download | serd-ff7d07e560eb32c9c10d41d25a7b8ea4cfdf7f69.tar.gz serd-ff7d07e560eb32c9c10d41d25a7b8ea4cfdf7f69.tar.bz2 serd-ff7d07e560eb32c9c10d41d25a7b8ea4cfdf7f69.zip |
Allocate nodes with posix_memalign when available
This fixes platforms where the system malloc returns memory that is not aligned
to sizeof(SerdNode) (128 bits).
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/system.h b/src/system.h index f17eb278..a9e6a732 100644 --- a/src/system.h +++ b/src/system.h @@ -1,5 +1,5 @@ /* - Copyright 2011-2018 David Robillard <http://drobilla.net> + Copyright 2011-2020 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -38,6 +38,12 @@ serd_file_read_byte(void* buf, size_t size, size_t nmemb, void* stream) return 1; } +/** Allocate a buffer aligned to `alignment` bytes. */ +void* serd_malloc_aligned(size_t size, size_t alignment); + +/** Allocate a zeroed buffer aligned to `alignment` bytes. */ +void* serd_calloc_aligned(size_t size, size_t alignment); + /** Allocate an aligned buffer for I/O. */ void* serd_allocate_buffer(size_t size); |