Changeset a41950dd in rtems


Ignore:
Timestamp:
May 2, 2012, 7:23:30 PM (7 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
4.11, master
Children:
f53aa8d
Parents:
3d74da6
git-author:
Gedare Bloom <gedare@…> (05/02/12 19:23:30)
git-committer:
Gedare Bloom <gedare@…> (05/08/12 22:40:44)
Message:

PR2061: RBTree: updating min and max on insert with duplicates

When inserting to a red-black tree with duplicates the min and max pointers are
not updated properly. We need to check the key of the min/max node against the
insert node since the insert point could be the child of a node with an
identical key to the min/max node.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/rbtreeinsert.c

    r3d74da6 ra41950dd  
    107107        the_node->parent = iter_node;
    108108        /* update min/max */
    109         if (_RBTree_Is_first(the_rbtree, iter_node, dir)) {
     109        compare_result = the_rbtree->compare_function(
     110            the_node,
     111            _RBTree_First(the_rbtree, dir)
     112        );
     113        if ( (!dir && _RBTree_Is_lesser(compare_result)) ||
     114              (dir && _RBTree_Is_greater(compare_result)) ) {
    110115          the_rbtree->first[dir] = the_node;
    111116        }
Note: See TracChangeset for help on using the changeset viewer.