diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-08-22 13:56:54 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-08-22 13:56:54 +0000 |
commit | 6136168881ebcb154e62f0a0296b4b829b6a5422 (patch) | |
tree | 4ac91ecfc3453e3b1a1678404e02793a0272a847 /c/src/exec/score/src/object.c | |
parent | Changed to reflect adding object class to id (diff) | |
download | rtems-6136168881ebcb154e62f0a0296b4b829b6a5422.tar.bz2 |
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.
Diffstat (limited to '')
-rw-r--r-- | c/src/exec/score/src/object.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/c/src/exec/score/src/object.c b/c/src/exec/score/src/object.c index bd8edaef58..0181903647 100644 --- a/c/src/exec/score/src/object.c +++ b/c/src/exec/score/src/object.c @@ -161,28 +161,36 @@ rtems_status_code _Objects_Name_to_id( Objects_Id *id ) { - Objects_Name *names; - unsigned32 index; + boolean search_local_node; + Objects_Control **objects; + Objects_Control *the_object; + unsigned32 index; if ( name == 0 ) return( RTEMS_INVALID_NAME ); - if ( (information->maximum != 0) && - (node == RTEMS_SEARCH_ALL_NODES || - node == RTEMS_SEARCH_LOCAL_NODE || - _Objects_Is_local_node( node )) ) { - for ( names = information->name_table, index = 1; - index <= information->maximum; - index++ - ) - if ( name == names[ index ] ) { - *id = _Objects_Build_id( - information->the_class, - _Objects_Local_node, - index - ); + search_local_node = FALSE; + + if ( information->maximum != 0 && + (node == RTEMS_SEARCH_ALL_NODES || node == RTEMS_SEARCH_LOCAL_NODE || + _Objects_Is_local_node( node ) ) ) + search_local_node = TRUE; + + if ( search_local_node ) { + objects = information->local_table; + + for ( index = 1; index <= information->maximum; index++ ) { + + the_object = objects[ index ]; + + if ( !the_object || !the_object->name ) + continue; + + if ( name == *the_object->name ) { + *id = the_object->id; return( RTEMS_SUCCESSFUL ); } + } } if ( _Objects_Is_local_node( node ) || node == RTEMS_SEARCH_LOCAL_NODE ) |