Add a CONTAINER_OF macro

This commit is contained in:
Přemysl Eric Janouch 2016-01-02 03:24:35 +01:00
parent b5724a654a
commit 4dfd88c2c8

View File

@ -112,6 +112,9 @@ extern char **environ;
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define XSTRINGIFY(x) STRINGIFY (x) #define XSTRINGIFY(x) STRINGIFY (x)
#define CONTAINER_OF(pointer, type, member) \
((type *) ((char *) pointer - offsetof (type, member)))
// --- Logging ----------------------------------------------------------------- // --- Logging -----------------------------------------------------------------
static void static void