Changeset 57c2985 in rtems


Ignore:
Timestamp:
Apr 7, 2014, 12:50:32 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
781631e
Parents:
e785fbaa
git-author:
Sebastian Huber <sebastian.huber@…> (04/07/14 12:50:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/07/14 12:51:31)
Message:

score: Lazy key value pair allocation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/key.c

    re785fbaa r57c2985  
    113113static void _POSIX_Keys_Initialize_keypool( void )
    114114{
    115   Freechain_Control *keypool = &_POSIX_Keys_Keypool;
    116115  size_t initial_count = _POSIX_Keys_Get_initial_keypool_size();
    117116  size_t size = initial_count * sizeof( POSIX_Keys_Key_value_pair );
    118   POSIX_Keys_Key_value_pair *nodes = _Workspace_Allocate_or_fatal_error( size );
    119117
    120   _Freechain_Initialize( keypool, _POSIX_Keys_Keypool_extend );
     118  if ( size > 0 ) {
     119    Freechain_Control *keypool = &_POSIX_Keys_Keypool;
     120    POSIX_Keys_Key_value_pair *nodes =
     121      _Workspace_Allocate_or_fatal_error( size );
    121122
    122   _Chain_Initialize(
    123     &keypool->Freechain,
    124     nodes,
    125     initial_count,
    126     sizeof( *nodes )
    127   );
     123    _Freechain_Initialize( keypool, _POSIX_Keys_Keypool_extend );
     124
     125    _Chain_Initialize(
     126      &keypool->Freechain,
     127      nodes,
     128      initial_count,
     129      sizeof( *nodes )
     130    );
     131  }
    128132}
    129133
Note: See TracChangeset for help on using the changeset viewer.