Changeset 61361688 in rtems for cpukit/score/src/object.c


Ignore:
Timestamp:
Aug 22, 1995, 1:56:54 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
b2c491a0
Parents:
2a0b721
Message:

Modified object name to id translation loop to make it easier to
incorporate variable length object names. Previously the algorithm
scanned an array of 4-byte names for a match. Now it scans the
object table, grabs a pointer to the name, and then compares it
if the object is active and has a name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/object.c

    r2a0b721 r61361688  
    162162)
    163163{
    164   Objects_Name *names;
    165   unsigned32    index;
     164  boolean           search_local_node;
     165  Objects_Control **objects;
     166  Objects_Control  *the_object;
     167  unsigned32        index;
    166168
    167169  if ( name == 0 )
    168170    return( RTEMS_INVALID_NAME );
    169171
    170   if ( (information->maximum != 0) &&
    171        (node == RTEMS_SEARCH_ALL_NODES ||
    172         node == RTEMS_SEARCH_LOCAL_NODE ||
    173         _Objects_Is_local_node( node )) ) {
    174     for ( names = information->name_table, index = 1;
    175           index <= information->maximum;
    176           index++
    177          )
    178       if ( name == names[ index ] ) {
    179         *id = _Objects_Build_id(
    180           information->the_class,
    181           _Objects_Local_node,
    182           index
    183         );
     172  search_local_node = FALSE;
     173
     174  if ( information->maximum != 0 &&
     175      (node == RTEMS_SEARCH_ALL_NODES || node == RTEMS_SEARCH_LOCAL_NODE ||
     176      _Objects_Is_local_node( node ) ) )
     177   search_local_node = TRUE;
     178
     179  if ( search_local_node ) {
     180    objects = information->local_table;
     181
     182    for ( index = 1; index <= information->maximum; index++ ) {
     183
     184      the_object = objects[ index ];
     185
     186      if ( !the_object || !the_object->name )
     187        continue;
     188
     189      if ( name == *the_object->name ) {
     190        *id = the_object->id;
    184191        return( RTEMS_SUCCESSFUL );
    185192      }
     193    }
    186194  }
    187195
Note: See TracChangeset for help on using the changeset viewer.