summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/rbtreeinsert.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-03 13:02:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-05 09:30:37 +0200
commit60fe374247eba365afb7f1a7055298af575434c7 (patch)
treec3323eaf5c6939c5c9e4fd64671a443dcd521150 /cpukit/score/src/rbtreeinsert.c
parentAdd and use RTEMS_CONTAINER_OF() (diff)
downloadrtems-60fe374247eba365afb7f1a7055298af575434c7.tar.bz2
rbtree: Add and use RBTree_Compare_result
Diffstat (limited to 'cpukit/score/src/rbtreeinsert.c')
-rw-r--r--cpukit/score/src/rbtreeinsert.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cpukit/score/src/rbtreeinsert.c b/cpukit/score/src/rbtreeinsert.c
index afff1ef5f9..3bccba5aaa 100644
--- a/cpukit/score/src/rbtreeinsert.c
+++ b/cpukit/score/src/rbtreeinsert.c
@@ -12,6 +12,16 @@
#include <rtems/score/rbtreeimpl.h>
+RTEMS_STATIC_ASSERT(
+ sizeof( RBTree_Compare_result ) >= sizeof( intptr_t ),
+ RBTree_Compare_result_intptr_t
+);
+
+RTEMS_STATIC_ASSERT(
+ sizeof( RBTree_Compare_result ) >= sizeof( int32_t ),
+ RBTree_Compare_result_int32_t
+);
+
/** @brief Validate and fix-up tree properties for a new insert/colored node
*
* This routine checks and fixes the Red-Black Tree properties based on
@@ -77,7 +87,8 @@ RBTree_Node *_RBTree_Insert(
} else {
/* typical binary search tree insert, descend tree to leaf and insert */
while ( iter_node ) {
- int compare_result = ( *compare )( the_node, iter_node );
+ RBTree_Compare_result compare_result =
+ ( *compare )( the_node, iter_node );
if ( is_unique && _RBTree_Is_equal( compare_result ) )
return iter_node;