diff mbox series

[RFC,1/2] realtime: Use offsetof() macro from <stddef.h>

Message ID 20240711104400.63355-1-pvorel@suse.cz
State Accepted
Headers show
Series [RFC,1/2] realtime: Use offsetof() macro from <stddef.h> | expand

Commit Message

Petr Vorel July 11, 2024, 10:43 a.m. UTC
offsetof() macro from <stddef.h> which uses __builtin_offsetof() should
be equivalent to the LTP custom implementation.

The replacement is required due sched_football.c rewrite into new API
(LTP library uses <stddef.h>, thus there is a redefinition).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/realtime/include/list.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Cyril Hrubis July 12, 2024, 9:57 a.m. UTC | #1
Hi!
This looks obviously OK.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

diff --git a/testcases/realtime/include/list.h b/testcases/realtime/include/list.h
index f87d602e4a..01159e34fc 100644
--- a/testcases/realtime/include/list.h
+++ b/testcases/realtime/include/list.h
@@ -39,6 +39,8 @@ 
 #ifndef _LINUX_LIST_H
 #define _LINUX_LIST_H
 
+#include <stddef.h>
+
 /*
  * These are non-NULL pointers that will result in page faults
  * under normal circumstances, used to verify that nobody uses
@@ -241,7 +243,6 @@  static inline void list_splice_init(struct list_head *list,
 	}
 }
 
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 /**
  * container_of - cast a member of a structure out to the containing structure
  * @ptr:	the pointer to the member.