From 93329884b9abdf4335806193cb66b3905a212e40 Mon Sep 17 00:00:00 2001 From: Philipp Kaeser Date: Tue, 25 Aug 2026 21:47:10 +0200 Subject: [PATCH] def: Fixes use of arguments in BS_CONTAINER_OF. --- include/libbase/def.h | 8 ++++---- src/signal.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/libbase/def.h b/include/libbase/def.h index 4b8ce04..d887db7 100644 --- a/include/libbase/def.h +++ b/include/libbase/def.h @@ -67,10 +67,10 @@ ({ \ __typeof__(elem_ptr) __elem_ptr = (elem_ptr); \ (NULL == __elem_ptr ? \ - (container_type*)__elem_ptr : \ - (container_type*)( \ - (uint8_t*)(elem_ptr) - \ - offsetof(container_type, elem_field))); \ + (container_type*)__elem_ptr : \ + (container_type*)( \ + (uint8_t*)(__elem_ptr) - \ + offsetof(container_type, elem_field))); \ }) #endif /* __LIBBASE_DEF_H__ */ diff --git a/src/signal.c b/src/signal.c index c4e8128..7d89703 100644 --- a/src/signal.c +++ b/src/signal.c @@ -148,11 +148,10 @@ void _bs_signal_test_simple(bs_test_t *test_ptr) test_ptr, &tl1, BS_CONTAINER_OF(&tl1.calls, struct bs_test_listener, calls)); - void *p = NULL; BS_TEST_VERIFY_EQ( test_ptr, NULL, - BS_CONTAINER_OF(p, struct bs_test_listener, calls)); + BS_CONTAINER_OF(NULL, struct bs_test_listener, calls)); BS_TEST_VERIFY_EQ(test_ptr, 0, tl1.calls); BS_TEST_VERIFY_EQ(test_ptr, 0, tl2.calls);