Skip to content
Snippets Groups Projects
Commit ead8afe8 authored by Alejandro Mery's avatar Alejandro Mery Committed by Andy Green
Browse files

add container_of() macro


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

Signed-off-by: default avatarAlejandro Mery <amery@geeks.cl>
parent 7ef88555
No related branches found
No related tags found
No related merge requests found
...@@ -209,6 +209,12 @@ typedef unsigned __int64 u_int64_t; ...@@ -209,6 +209,12 @@ typedef unsigned __int64 u_int64_t;
#include <endian.h> #include <endian.h>
#endif #endif
#include <stddef.h>
#ifndef container_of
#define container_of(P,T,M) ((T *)((char *)(P) - offsetof(T, M)))
#endif
#if defined(__QNX__) #if defined(__QNX__)
#include <gulliver.h> #include <gulliver.h>
#if defined(__LITTLEENDIAN__) #if defined(__LITTLEENDIAN__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment