This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new f80030cea kernel/os: Check if CONTAINER_OF is already defined
f80030cea is described below

commit f80030cea9286cd602b7c4be3155e0f0a700c313
Author: Szymon Janc <[email protected]>
AuthorDate: Thu May 21 14:02:36 2026 +0200

    kernel/os: Check if CONTAINER_OF is already defined
    
    Check if CONTAINER_OF is already defined before defining in the OS.
    This is quite common macro name and may cause macro redefine error
    otherwise.
---
 kernel/os/include/os/util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/os/include/os/util.h b/kernel/os/include/os/util.h
index 3e59670c4..f272a0a34 100644
--- a/kernel/os/include/os/util.h
+++ b/kernel/os/include/os/util.h
@@ -27,8 +27,10 @@
 #define INT_TO_POINTER(u) ((void *) ((intptr_t) (u)))
 
 /* Helper to retrieve pointer to "parent" object in structure */
+#ifndef CONTAINER_OF
 #define CONTAINER_OF(ptr, type, field) \
         ((type *)(((char *)(ptr)) - offsetof(type, field)))
+#endif
 
 /* Helper to calculate number of elements in array */
 #ifndef ARRAY_SIZE

Reply via email to