summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-08-22 13:56:54 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-08-22 13:56:54 +0000
commit6136168881ebcb154e62f0a0296b4b829b6a5422 (patch)
tree4ac91ecfc3453e3b1a1678404e02793a0272a847 /cpukit/score/src
parentChanged to reflect adding object class to id (diff)
downloadrtems-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 'cpukit/score/src')
-rw-r--r--cpukit/score/src/object.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/cpukit/score/src/object.c b/cpukit/score/src/object.c
index bd8edaef58..0181903647 100644
--- a/cpukit/score/src/object.c
+++ b/cpukit/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 )