From 050adc2712d2b78697fed19d0312f94971402cd0 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Thu, 20 Oct 2011 11:58:54 +0000 Subject: =?UTF-8?q?2011-10-20=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * score/include/rtems/score/rbtree.h (_RBTree_Container_of): Use offsetof. Don't cast to size_t. Include . --- cpukit/score/include/rtems/score/rbtree.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cpukit/score/include') diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h index d2cea57208..1c7953ffad 100644 --- a/cpukit/score/include/rtems/score/rbtree.h +++ b/cpukit/score/include/rtems/score/rbtree.h @@ -18,6 +18,8 @@ #ifndef _RTEMS_SCORE_RBTREE_H #define _RTEMS_SCORE_RBTREE_H +#include + /** * @defgroup ScoreRBTree Red-Black Tree Handler * @@ -88,8 +90,7 @@ struct RBTree_Node_struct { * */ #define _RBTree_Container_of(node,container_type, node_field_name) \ -((container_type*) \ - ((size_t)node - ((size_t)(&((container_type *)0)->node_field_name)))) + ((container_type*) (node - offsetof(container_type,node_field_name))) /** * This type indicates the direction. -- cgit v1.2.3