Changeset a7643178 in rtems


Ignore:
Timestamp:
Jul 31, 2009, 4:07:51 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
ba23ff5
Parents:
64bad68b
Message:

2009-07-31 Joel Sherrill <joel.sherrill@…>

  • score/src/heapgetinfo.c: Simplify implementation.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r64bad68b ra7643178  
     12009-07-31      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * score/src/heapgetinfo.c: Simplify implementation.
     4
    152009-07-29      Joel Sherrill <joel.sherrill@oarcorp.com>
    26
  • cpukit/score/src/heapgetinfo.c

    r64bad68b ra7643178  
    22 *  Heap Handler
    33 *
    4  *  COPYRIGHT (c) 1989-2000.
     4 *  COPYRIGHT (c) 1989-2009.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
     
    2020#include <rtems/score/heap.h>
    2121
    22 /*PAGE
    23  *
     22/*
    2423 *  _Heap_Get_information
    2524 *
     
    3534 *    return 0=success, otherwise heap is corrupt.
    3635 */
    37 
    3836Heap_Get_information_status _Heap_Get_information(
    3937  Heap_Control            *the_heap,
     
    5553
    5654  while ( the_block != end ) {
    57     uint32_t const the_size = _Heap_Block_size(the_block);
    58     Heap_Block *const next_block = _Heap_Block_at(the_block, the_size);
     55    uint32_t const     the_size = _Heap_Block_size(the_block);
     56    Heap_Block *const  next_block = _Heap_Block_at(the_block, the_size);
     57    Heap_Information  *info;
    5958
    60     if ( _Heap_Is_prev_used(next_block) ) {
    61       the_info->Used.number++;
    62       the_info->Used.total += the_size;
    63       if ( the_info->Used.largest < the_size )
    64         the_info->Used.largest = the_size;
    65     } else {
    66       the_info->Free.number++;
    67       the_info->Free.total += the_size;
    68       if ( the_info->Free.largest < the_size )
    69         the_info->Free.largest = the_size;
    70       if ( the_size != next_block->prev_size )
    71         return HEAP_GET_INFORMATION_BLOCK_ERROR;
    72     }
     59    if ( _Heap_Is_prev_used(next_block) )
     60      info = &the_info->Used;
     61    else
     62      info = &the_info->Free;
     63
     64    info->number++;
     65    info->total += the_size;
     66    if ( info->largest < the_size )
     67      info->largest = the_size;
    7368
    7469    the_block = next_block;
    7570  }
    7671
    77   /* Handle the last dummy block. Don't consider this block to be
    78      "used" as client never allocated it. Make 'Used.total' contain this
    79      blocks' overhead though. */
     72  /*
     73   *  Handle the last dummy block. Don't consider this block to be
     74   *  "used" as client never allocated it. Make 'Used.total' contain this
     75   *  blocks' overhead though.
     76   */
    8077  the_info->Used.total += HEAP_OVERHEAD;
    8178
Note: See TracChangeset for help on using the changeset viewer.