From 181715c5bc6e74f87fe284b063ca301a300ad098 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 1 Sep 2014 22:03:43 +0200 Subject: Add alloc helpers for aligned allocations --- src/buffer.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/buffer.h') 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 }; } -- cgit v1.2.3