summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-06-25 07:49:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-31 16:19:57 +0200
commit1818b9a8269c4809b229c3bfa95896f067256bbe (patch)
treefbf71ae2b4070e60070a66314c2acd10c95958a3
parentc7e30854f284a17200892ce8e5405744e3c46c24 (diff)
downloadrtems-1818b9a8269c4809b229c3bfa95896f067256bbe.tar.bz2
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.
-rw-r--r--cpukit/score/src/objectmp.c1
-rw-r--r--cpukit/score/src/objectnametoid.c4
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;
}
}