diff options
author | NRK <nrk@disroot.org> | 2023-10-20 22:33:38 +0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-23 00:10:42 +0000 |
commit | 876915edd304aba1bbdf0c51befe8ea4e5ba7199 (patch) | |
tree | 410895ba4bbfd0dd9d4863243ded6bf941622f3a /ta/ta.c | |
parent | 8dc12f1d5bb524edf4bb7121bb3f3b2ffa32c73d (diff) | |
download | mpv-876915edd304aba1bbdf0c51befe8ea4e5ba7199.tar.bz2 mpv-876915edd304aba1bbdf0c51befe8ea4e5ba7199.tar.xz |
ta: don't hardcode alignment requirement
use standard C11 max_align_t instead.
also sorts the standard header includes.
ref: https://en.cppreference.com/w/c/types/max_align_t
Diffstat (limited to 'ta/ta.c')
-rw-r--r-- | ta/ta.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -13,18 +13,15 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <assert.h> +#include <stddef.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> -#include <stdio.h> -#include <assert.h> #define TA_NO_WRAPPERS #include "ta.h" -// Note: the actual minimum alignment is dictated by malloc(). It doesn't -// make sense to set this value higher than malloc's alignment. -#define MIN_ALIGN 16 - #if !defined(TA_MEMORY_DEBUGGING) #if !defined(NDEBUG) #define TA_MEMORY_DEBUGGING 1 @@ -52,6 +49,7 @@ struct ta_header { #define CANARY 0xD3ADB3EF +#define MIN_ALIGN _Alignof(max_align_t) union aligned_header { struct ta_header ta; // Make sure to satisfy typical alignment requirements |