diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-01 22:03:43 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-01 22:03:43 +0200 |
commit | 181715c5bc6e74f87fe284b063ca301a300ad098 (patch) | |
tree | d8fd0089df6521cb69d12971efba5d8e90c611cf /src/buffer.h | |
parent | 1a30018711528fe51fb17c70b8c1d9300c925c1c (diff) | |
download | fastd-181715c5bc6e74f87fe284b063ca301a300ad098.tar fastd-181715c5bc6e74f87fe284b063ca301a300ad098.zip |
Add alloc helpers for aligned allocations
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/buffer.h b/src/buffer.h index 5b2e16a..58e8023 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -32,7 +32,7 @@ #pragma once -#include "log.h" +#include "alloc.h" /** A buffer descriptor */ @@ -55,10 +55,7 @@ struct fastd_buffer { */ static inline fastd_buffer_t fastd_buffer_alloc(const size_t len, size_t head_space, size_t tail_space) { size_t base_len = head_space+len+tail_space; - void *ptr; - int err = posix_memalign(&ptr, 16, base_len); - if (err) - exit_error("posix_memalign: %s", strerror(err)); + void *ptr = fastd_alloc_aligned(base_len, 16); return (fastd_buffer_t){ .base = ptr, .base_len = base_len, .data = ptr+head_space, .len = len }; } |