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
1 changed files with 3 additions and 0 deletions

View File

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