diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-12 11:16:45 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-08-12 11:16:45 +0200 |
commit | 55faa447686f632bf1b98827cdec37a44bd69da2 (patch) | |
tree | bdb60a635a651e1a3f61d7e35dc7e654c679cfa0 /cpukit/score/include/rtems/score/rbtree.h | |
parent | score: Introduce thread queue surrender operation (diff) | |
download | rtems-55faa447686f632bf1b98827cdec37a44bd69da2.tar.bz2 |
score: Improve _RBTree_Insert_inline()
Return if the inserted node is the new minimum node or not.
Diffstat (limited to 'cpukit/score/include/rtems/score/rbtree.h')
-rw-r--r-- | cpukit/score/include/rtems/score/rbtree.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cpukit/score/include/rtems/score/rbtree.h b/cpukit/score/include/rtems/score/rbtree.h index e94560ea88..a5a6cf367b 100644 --- a/cpukit/score/include/rtems/score/rbtree.h +++ b/cpukit/score/include/rtems/score/rbtree.h @@ -451,8 +451,12 @@ void _RBTree_Replace_node( * the key is stored in a local variable. * @param less Must return true if the specified key is less than the key of * the node, otherwise false. + * + * @retval true The inserted node is the new minimum node according to the + * specified less order function. + * @retval false Otherwise. */ -RTEMS_INLINE_ROUTINE void _RBTree_Insert_inline( +RTEMS_INLINE_ROUTINE bool _RBTree_Insert_inline( RBTree_Control *the_rbtree, RBTree_Node *the_node, const void *key, @@ -461,9 +465,11 @@ RTEMS_INLINE_ROUTINE void _RBTree_Insert_inline( { RBTree_Node **link; RBTree_Node *parent; + bool is_new_minimum; link = _RBTree_Root_reference( the_rbtree ); parent = NULL; + is_new_minimum = true; while ( *link != NULL ) { parent = *link; @@ -472,11 +478,13 @@ RTEMS_INLINE_ROUTINE void _RBTree_Insert_inline( link = _RBTree_Left_reference( parent ); } else { link = _RBTree_Right_reference( parent ); + is_new_minimum = false; } } _RBTree_Add_child( the_node, parent, link ); _RBTree_Insert_color( the_rbtree, the_node ); + return is_new_minimum; } /** |