Blame SOURCES/0077-macros.h-introduce-sizeof_field-macro.patch

86f512
From ed47b3a326d40e864926c0a456903bdbd3c23e87 Mon Sep 17 00:00:00 2001
86f512
From: Eugene Syromyatnikov <evgsyr@gmail.com>
86f512
Date: Fri, 1 Nov 2019 01:57:16 +0100
86f512
Subject: [PATCH] macros.h: introduce sizeof_field macro
86f512
86f512
Handy for field size checks.
86f512
86f512
* macros.h (sizeof_field): New macro.
86f512
(offsetofend): Use it.
86f512
---
86f512
 macros.h | 4 +++-
86f512
 1 file changed, 3 insertions(+), 1 deletion(-)
86f512
86f512
diff --git a/macros.h b/macros.h
86f512
index c58ac6a..d7e191f 100644
86f512
--- a/macros.h
86f512
+++ b/macros.h
86f512
@@ -37,9 +37,11 @@
86f512
 #  define ROUNDUP(val_, div_) (ROUNDUP_DIV((val_), (div_)) * (div_))
86f512
 # endif
86f512
 
86f512
+# define sizeof_field(type_, member_) (sizeof(((type_ *)0)->member_))
86f512
+
86f512
 # ifndef offsetofend
86f512
 #  define offsetofend(type_, member_)	\
86f512
-	(offsetof(type_, member_) + sizeof(((type_ *)0)->member_))
86f512
+	(offsetof(type_, member_) + sizeof_field(type_, member_))
86f512
 # endif
86f512
 
86f512
 # ifndef cast_ptr
86f512
-- 
86f512
2.1.4
86f512