source: rtems/cpukit/score/src/heapsizeofuserarea.c @ 4fc370e

4.115
Last change on this file since 4fc370e was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreHeap
5 *
6 * @brief Heap Handler implementation.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/score/sysstate.h>
24#include <rtems/score/heap.h>
25
26bool _Heap_Size_of_alloc_area(
27  Heap_Control *heap,
28  void *alloc_begin_ptr,
29  uintptr_t *alloc_size
30)
31{
32  uintptr_t const page_size = heap->page_size;
33  uintptr_t const alloc_begin = (uintptr_t) alloc_begin_ptr;
34  Heap_Block *block = _Heap_Block_of_alloc_area( alloc_begin, page_size );
35  Heap_Block *next_block = NULL;
36  uintptr_t block_size = 0;
37
38  if ( !_Heap_Is_block_in_heap( heap, block ) ) {
39    return false;
40  }
41
42  block_size = _Heap_Block_size( block );
43  next_block = _Heap_Block_at( block, block_size );
44
45  if (
46    !_Heap_Is_block_in_heap( heap, next_block )
47      || !_Heap_Is_prev_used( next_block )
48  ) {
49    return false;
50  }
51
52  *alloc_size = (uintptr_t) next_block + HEAP_ALLOC_BONUS - alloc_begin;
53
54  return true;
55}
56
Note: See TracBrowser for help on using the repository browser.