mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
29 lines
858 B
Diff
29 lines
858 B
Diff
|
From d81d24b9d4c897c508799cb390b13cb018758709 Mon Sep 17 00:00:00 2001
|
||
|
From: Benjamin Valentin <benpicco@zedat.fu-berlin.de>
|
||
|
Date: Fri, 10 Oct 2014 02:05:01 +0200
|
||
|
Subject: [PATCH] only define container_of when necessary
|
||
|
|
||
|
---
|
||
|
src-api/common/container_of.h | 2 ++
|
||
|
1 file changed, 2 insertions(+)
|
||
|
|
||
|
diff --git a/src-api/common/container_of.h b/src-api/common/container_of.h
|
||
|
index 9fd1893..fcb38fe 100644
|
||
|
--- a/src-api/common/container_of.h
|
||
|
+++ b/src-api/common/container_of.h
|
||
|
@@ -58,10 +58,12 @@
|
||
|
* @param member name of node inside struct
|
||
|
* @return pointer to surrounding struct
|
||
|
*/
|
||
|
+#ifndef container_of
|
||
|
#define container_of(ptr, type, member) ({ \
|
||
|
const typeof(((type *)0)->member ) *__tempptr = (ptr); \
|
||
|
(type *)((char *)__tempptr - offsetof(type,member)); \
|
||
|
})
|
||
|
+#endif
|
||
|
|
||
|
/**
|
||
|
* Helper function for NULL safe container_of macro
|
||
|
--
|
||
|
1.9.1
|