diff options
author | David Robillard <d@drobilla.net> | 2019-04-09 10:28:59 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | e2d2c7b027ac9ac142ae306d248f2d687df211eb (patch) | |
tree | c8326d3deb8b9bb23e2c815d88b917220ef0d85b /src/node.h | |
parent | 68b30967872915b93c600e353d2fd6d5fb4987c6 (diff) | |
download | serd-e2d2c7b027ac9ac142ae306d248f2d687df211eb.tar.gz serd-e2d2c7b027ac9ac142ae306d248f2d687df211eb.tar.bz2 serd-e2d2c7b027ac9ac142ae306d248f2d687df211eb.zip |
Align nodes with posix_memalign if possible
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -28,6 +28,14 @@ struct SerdNodeImpl { SerdNodeType type; /**< Node type */ }; +/* We need nodes aligned to at least size_t so that this is not an unaligned + access. Though it would be possible to make the node header fixed-size and + fit entirely in 64 bits, saving some memory in the process, using weird + types here needs a lot of sketchy casting, particularly since size_t is + universal for string lengths in C. So, we simply suffer the hassle (and + overhead) internally for now to prevent the API from being too weird. */ +static const size_t serd_node_align = sizeof(size_t); + static inline char* serd_node_buffer(SerdNode* node) { |