source: rtems/cpukit/score/src/heapiterate.c @ e8fffc2d

4.115
Last change on this file since e8fffc2d was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 991 bytes
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreHeap
5 *
6 * @brief _Heap_Iterate() implementation.
7 */
8
9/*
10 * Copyright (c) 2011 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#if HAVE_CONFIG_H
24  #include "config.h"
25#endif
26
27#include <rtems/score/heapimpl.h>
28
29void _Heap_Iterate(
30  Heap_Control *heap,
31  Heap_Block_visitor visitor,
32  void *visitor_arg
33)
34{
35  Heap_Block *current = heap->first_block;
36  Heap_Block *end = heap->last_block;
37  bool stop = false;
38
39  while ( !stop && current != end ) {
40    uintptr_t size = _Heap_Block_size( current );
41    Heap_Block *next = _Heap_Block_at( current, size );
42    bool used = _Heap_Is_prev_used( next );
43
44    stop = (*visitor)( current, size, used, visitor_arg );
45
46    current = next;
47  }
48}
Note: See TracBrowser for help on using the repository browser.