source: rtems/cpukit/score/src/rbtree.c @ 8ae37323

4.115
Last change on this file since 8ae37323 was d7a94693, checked in by Sebastian Huber <sebastian.huber@…>, on 07/21/14 at 16:16:47

rbtree: Remove superfluous NULL pointer checks

  • Property mode set to 100644
File size: 1002 bytes
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  /* could do sanity checks here */
38  _RBTree_Initialize_empty( the_rbtree );
39
40  count = number_nodes;
41  next = starting_address;
42
43  while ( count-- ) {
44    _RBTree_Insert( the_rbtree, next, compare, is_unique );
45    next = (RBTree_Node *) _Addresses_Add_offset( next, node_size );
46  }
47}
Note: See TracBrowser for help on using the repository browser.