Use statically known types, use hash for formats
[babeltrace.git] / include / babeltrace / compiler.h
index 7850ded675a3bb75ce892e2f74d75fcb915561ab..c8bb4db5b8cd38d61be56aa06da8f892d3e13969 100644 (file)
@@ -3,4 +3,12 @@
 
 #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
 
+#ifndef container_of
+#define container_of(ptr, type, member)                                        \
+       ({                                                              \
+               const typeof(((type *)NULL)->member) * __ptr = (ptr);   \
+               (type *)((char *)__ptr - offsetof(type, member));       \
+       })
+#endif
+
 #endif /* _BABELTRACE_COMPILER_H */
This page took 0.023146 seconds and 4 git commands to generate.