diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-02 03:24:35 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-03 23:35:21 +0100 |
commit | 4dfd88c2c814020559f18d62b15e680f3c7a9b35 (patch) | |
tree | c5f97d2a17c58b6cf506e10d4d5f77db90a21163 | |
parent | b5724a654a4aadeabcfa3de3847768239931c687 (diff) | |
download | liberty-4dfd88c2c814020559f18d62b15e680f3c7a9b35.tar.gz liberty-4dfd88c2c814020559f18d62b15e680f3c7a9b35.tar.xz liberty-4dfd88c2c814020559f18d62b15e680f3c7a9b35.zip |
Add a CONTAINER_OF macro
-rw-r--r-- | liberty.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 |