Changeset f32c036 in rtems


Ignore:
Timestamp:
Aug 7, 2009, 12:19:04 AM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
248db21
Parents:
8eb28306
Message:

2009-08-06 Joel Sherrill <joel.sherrill@…>

  • score/src/objectextendinformation.c: Minor rework to eliminate uncovered ranges introduced by Chris' patch.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r8eb28306 rf32c036  
     12009-08-06      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * score/src/objectextendinformation.c: Minor rework to eliminate
     4        uncovered ranges introduced by Chris' patch.
     5
    162009-08-06      Chris Johns <chrisj@rtems.org>
    27
  • cpukit/score/src/objectextendinformation.c

    r8eb28306 rf32c036  
    5454  uint32_t          minimum_index;
    5555  uint32_t          index;
     56  uint32_t          maximum;
     57  size_t            block_size;
    5658  void             *new_object_block;
    5759
     
    7880  }
    7981
     82  maximum = (uint32_t) information->maximum + information->allocation_size;
     83
     84  /*
     85   *  We need to limit the number of objects to the maximum number
     86   *  representable in the index portion of the object Id.  In the
     87   *  case of 16-bit Ids, this is only 256 object instances.
     88   */
     89  if ( maximum > OBJECTS_ID_FINAL_INDEX ) {
     90    return;
     91  }
     92
    8093  /*
    8194   * Allocate the name table, and the objects and if it fails either return or
     
    8396   */
    8497 
    85   new_object_block =
    86     _Workspace_Allocate(
    87       (information->allocation_size * information->size)
    88     );
    89  
    90   if ( new_object_block == NULL ) {
    91     if ( information->auto_extend ) {
     98  block_size = information->allocation_size * information->size;
     99  if ( information->auto_extend ) {
     100    new_object_block = _Workspace_Allocate( block_size );
     101    if ( !new_object_block )
    92102      return;
    93     }
    94     else {
    95       _Internal_error_Occurred(
    96         INTERNAL_ERROR_CORE,
    97         true,
    98         INTERNAL_ERROR_WORKSPACE_ALLOCATION
    99       );
    100     }
     103  } else {
     104    new_object_block = _Workspace_Allocate_or_fatal_error( block_size );
    101105  }
    102106 
     
    110114    uint32_t         *inactive_per_block;
    111115    Objects_Control **local_table;
    112     uint32_t          maximum;
    113116    void             *old_tables;
    114117    size_t            block_size;
     
    136139
    137140    block_count++;
    138 
    139     maximum = (uint32_t) information->maximum + information->allocation_size;
    140 
    141     /*
    142      *  We need to limit the number of objects to the maximum number
    143      *  representable in the index portion of the object Id.  In the
    144      *  case of 16-bit Ids, this is only 256 object instances.
    145      */
    146     if ( maximum > OBJECTS_ID_FINAL_INDEX ) {
    147       if ( !_Workspace_Free( new_object_block ) ) {
    148         _Internal_error_Occurred(
    149           INTERNAL_ERROR_CORE,
    150           true,
    151           INTERNAL_ERROR_WORKSPACE_ALLOCATION
    152         );
    153       }
    154       return;
    155     }
    156141
    157142    /*
     
    165150
    166151    if ( !object_blocks ) {
    167       if ( !_Workspace_Free( new_object_block ) ) {
    168         _Internal_error_Occurred(
    169           INTERNAL_ERROR_CORE,
    170           true,
    171           INTERNAL_ERROR_WORKSPACE_ALLOCATION
    172         );
    173       }
     152      _Workspace_Free( new_object_block );
    174153      return;
    175154    }
Note: See TracChangeset for help on using the changeset viewer.