From 1818b9a8269c4809b229c3bfa95896f067256bbe Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 25 Jun 2020 07:49:50 +0200 Subject: score: Optimize _Objects_Name_to_id_u32() Remove the superfluous invalid name check since the object creation directives ensure that objects with such a name cannot exist. Also finding an object with such a name would be no catastrophy if it really exists. --- cpukit/score/src/objectmp.c | 1 + cpukit/score/src/objectnametoid.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c index e956135a91..74d55305a9 100644 --- a/cpukit/score/src/objectmp.c +++ b/cpukit/score/src/objectmp.c @@ -325,6 +325,7 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search( if ( the_global_object != NULL ) { *the_id = the_global_object->id; + _Assert( the_global_object->name.name_u32 != 0 ); status = OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; } else { status = OBJECTS_INVALID_NAME; diff --git a/cpukit/score/src/objectnametoid.c b/cpukit/score/src/objectnametoid.c index d89e161c8c..ba73bdbad6 100644 --- a/cpukit/score/src/objectnametoid.c +++ b/cpukit/score/src/objectnametoid.c @@ -40,9 +40,6 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( if ( !id ) return OBJECTS_INVALID_ADDRESS; - if ( name == 0 ) - return OBJECTS_INVALID_NAME; - maximum = _Objects_Get_maximum_index( information ); search_local_node = false; @@ -61,6 +58,7 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( if ( name == the_object->name.name_u32 ) { *id = the_object->id; + _Assert( name != 0 ); return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; } } -- cgit v1.2.3