diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-11-24 11:51:28 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-12-07 14:22:01 +0100 |
commit | 3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b (patch) | |
tree | 3912fc89bbde8a64a20111e02c618e85eb7bb000 /cpukit/score/src/objectnametoid.c | |
parent | score: Rename Objects_Information::allocation_size (diff) | |
download | rtems-3899bc1a4b3294306ae2fd3f8ff0ee10365d9f4b.tar.bz2 |
score: Optimize object lookup
Use the maximum ID for the ID to object translation. Using the maximum
ID gets rid of an additional load from the object information in
_Objects_Get(). In addition, object lookups fail for every ID in case
the object information is cleared to zero. This makes it a bit more
robust during system startup (see new tests in spconfig02).
The local table no longer needs a NULL pointer entry at array index
zero. Adjust all the object iteration loops accordingly.
Remove Objects_Information::minimum_id since it contains only redundant
information. Add _Objects_Get_minimum_id() to get the minimum ID.
Update #3621.
Diffstat (limited to 'cpukit/score/src/objectnametoid.c')
-rw-r--r-- | cpukit/score/src/objectnametoid.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cpukit/score/src/objectnametoid.c b/cpukit/score/src/objectnametoid.c index 030d64a4bd..c3b014e3e1 100644 --- a/cpukit/score/src/objectnametoid.c +++ b/cpukit/score/src/objectnametoid.c @@ -29,7 +29,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( { bool search_local_node; Objects_Control *the_object; - uint32_t index; + Objects_Maximum index; #if defined(RTEMS_MULTIPROCESSING) Objects_Name name_for_mp; #endif @@ -52,7 +52,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( search_local_node = true; if ( search_local_node ) { - for ( index = 1; index <= information->maximum; index++ ) { + for ( index = 0; index < information->maximum; ++index ) { the_object = information->local_table[ index ]; if ( !the_object ) continue; |