util: squelch clang cast alignment warning caused by container_of()

This commit is contained in:
Bert Belder 2018-05-16 22:24:38 -07:00
parent 3098a3cda5
commit 0a817e84ec
No known key found for this signature in database
GPG Key ID: 7A77887B2E2ED461

View File

@ -3,6 +3,7 @@
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include "internal.h"
@ -12,8 +13,10 @@ typedef intptr_t ssize_t;
#define array_count(a) (sizeof(a) / (sizeof((a)[0])))
/* clang-format off */
#define container_of(ptr, type, member) \
((type*) ((char*) (ptr) -offsetof(type, member)))
((type*) ((uintptr_t) (ptr) - offsetof(type, member)))
/* clang-format on */
#define unused_var(v) ((void) (v))