summaryrefslogtreecommitdiff
path: root/src/main/c/common/container_of.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/c/common/container_of.h')
-rw-r--r--src/main/c/common/container_of.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/c/common/container_of.h b/src/main/c/common/container_of.h
new file mode 100644
index 0000000..c484697
--- /dev/null
+++ b/src/main/c/common/container_of.h
@@ -0,0 +1,4 @@
+#ifndef container_of
+# define container_of(P, T, M) \
+ ((T*)( ((size_t)P) - ((size_t)((char*)&((T*)0)->M - (char*)0) )))
+#endif