source: rtems/cpukit/score/src/rbtree.c @ 64939bc

4.11
Last change on this file since 64939bc was 64939bc, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 12, 2014 at 7:22:22 PM

rbtree: Reduce RBTree_Control size

Remove compare function and is unique indicator from the control
structure. Rename RBTree_Compare_function to RBTree_Compare. Rename
rtems_rbtree_compare_function to rtems_rbtree_compare. Provide C++
compatible initializers. Add compare function and is unique indicator
to _RBTree_Find(), _RBTree_Insert(), rtems_rbtree_find() and
rtems_rbtree_insert(). Remove _RBTree_Is_unique() and
rtems_rbtree_is_unique(). Remove compare function and is unique
indicator from _RBTree_Initialize_empty() and
rtems_rbtree_initialize_empty().

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Initialize a RBTree Header
5 *  @ingroup ScoreRBTree
6 */
7
8/*
9 *  Copyright (c) 2010 Gedare Bloom.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#if HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <rtems/system.h>
21#include <rtems/score/address.h>
22#include <rtems/score/rbtree.h>
23#include <rtems/score/isr.h>
24
25void _RBTree_Initialize(
26  RBTree_Control *the_rbtree,
27  RBTree_Compare  compare,
28  void           *starting_address,
29  size_t          number_nodes,
30  size_t          node_size,
31  bool            is_unique
32)
33{
34  size_t      count;
35  RBTree_Node *next;
36
37  /* TODO: Error message? */
38  if (!the_rbtree) return;
39
40  /* could do sanity checks here */
41  _RBTree_Initialize_empty( the_rbtree );
42
43  count = number_nodes;
44  next  = starting_address;
45  while ( count-- ) {
46    _RBTree_Insert( the_rbtree, next, compare, is_unique );
47    next = (RBTree_Node *) _Addresses_Add_offset( next, node_size );
48  }
49}
Note: See TracBrowser for help on using the repository browser.