1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

add container_of() macro

to be used to remove cast abuse and finding parent structs later

Signed-off-by: Alejandro Mery <amery@geeks.cl>
This commit is contained in:
Alejandro Mery 2014-12-07 03:36:11 +01:00 committed by Andy Green
parent 7ef8855530
commit ead8afe8a1

View file

@ -209,6 +209,12 @@ typedef unsigned __int64 u_int64_t;
#include <endian.h>
#endif
#include <stddef.h>
#ifndef container_of
#define container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
#endif
#if defined(__QNX__)
#include <gulliver.h>
#if defined(__LITTLEENDIAN__)