summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commonlib/include/commonlib/helpers.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/helpers.h b/src/commonlib/include/commonlib/helpers.h
index d2ef94196d..0a796ba85b 100644
--- a/src/commonlib/include/commonlib/helpers.h
+++ b/src/commonlib/include/commonlib/helpers.h
@@ -85,6 +85,9 @@
const __typeof__(((type *)0)->member) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); })
+/* Calculate size of structure member. */
+#define member_size(type, member) (sizeof(((type *)0)->member))
+
#ifndef __unused
#define __unused __attribute__((unused))
#endif