diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-11-21 17:30:52 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-12-07 14:22:01 +0100 |
commit | 9c9c6a93b1a17ad12f61b41e1d5f4616871cdba7 (patch) | |
tree | f17c5de012a4827131416d31dcb8a3e623be9873 /cpukit/score | |
parent | score: Remove dead code (diff) | |
download | rtems-9c9c6a93b1a17ad12f61b41e1d5f4616871cdba7.tar.bz2 |
score: Remove Objects_Information::is_string
Use Objects_Information::name_length to store this information.
Update #3621.
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/src/objectgetnameasstring.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/objectidtoname.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/objectinitializeinformation.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/objectnamespaceremove.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/objectnametoidstring.c | 2 | ||||
-rw-r--r-- | cpukit/score/src/objectsetname.c | 43 | ||||
-rw-r--r-- | cpukit/score/src/thread.c | 3 |
7 files changed, 29 insertions, 31 deletions
diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c index ed6a73c0f8..845334075a 100644 --- a/cpukit/score/src/objectgetnameasstring.c +++ b/cpukit/score/src/objectgetnameasstring.c @@ -114,7 +114,7 @@ char *_Objects_Get_name_as_string( _Objects_Name_to_string( the_object->name, - information->is_string, + _Objects_Has_string_name( information ), name, length ); diff --git a/cpukit/score/src/objectidtoname.c b/cpukit/score/src/objectidtoname.c index 85eb409a8e..63948160e6 100644 --- a/cpukit/score/src/objectidtoname.c +++ b/cpukit/score/src/objectidtoname.c @@ -40,7 +40,7 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( if ( !information ) return OBJECTS_INVALID_ID; - if ( information->is_string ) + if ( _Objects_Has_string_name( information ) ) return OBJECTS_INVALID_ID; the_object = _Objects_Get( diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c index 23c7819bfa..2105c325d3 100644 --- a/cpukit/score/src/objectinitializeinformation.c +++ b/cpukit/score/src/objectinitializeinformation.c @@ -30,8 +30,7 @@ void _Objects_Do_initialize_information( uint16_t the_class, uint32_t maximum, uint16_t size, - bool is_string, - uint32_t maximum_name_length + uint16_t maximum_name_length #if defined(RTEMS_MULTIPROCESSING) , Objects_Thread_queue_Extract_callout extract @@ -49,7 +48,6 @@ void _Objects_Do_initialize_information( information->inactive_per_block = 0; information->object_blocks = 0; information->inactive = 0; - information->is_string = is_string; /* * Set the maximum value to 0. It will be updated when objects are diff --git a/cpukit/score/src/objectnamespaceremove.c b/cpukit/score/src/objectnamespaceremove.c index cc2c954a77..122ed862b7 100644 --- a/cpukit/score/src/objectnamespaceremove.c +++ b/cpukit/score/src/objectnamespaceremove.c @@ -27,7 +27,7 @@ void _Objects_Namespace_remove_u32( Objects_Control *the_object ) { - _Assert( !information->is_string ); + _Assert( !_Objects_Has_string_name( information ) ); the_object->name.name_u32 = 0; } @@ -38,7 +38,7 @@ void _Objects_Namespace_remove_string( { char *name; - _Assert( information->is_string ); + _Assert( _Objects_Has_string_name( information ) ); name = RTEMS_DECONST( char *, the_object->name.name_p ); the_object->name.name_p = NULL; _Workspace_Free( name ); diff --git a/cpukit/score/src/objectnametoidstring.c b/cpukit/score/src/objectnametoidstring.c index dd69f8a9ea..3bca0441e0 100644 --- a/cpukit/score/src/objectnametoidstring.c +++ b/cpukit/score/src/objectnametoidstring.c @@ -33,7 +33,7 @@ Objects_Control *_Objects_Get_by_name( size_t max_name_length; uint32_t index; - _Assert( information->is_string ); + _Assert( _Objects_Has_string_name( information ) ); _Assert( _Objects_Allocator_is_owner() ); if ( name == NULL ) { diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c index 227de515ec..32197a3cf8 100644 --- a/cpukit/score/src/objectsetname.c +++ b/cpukit/score/src/objectsetname.c @@ -29,32 +29,33 @@ bool _Objects_Set_name( const char *name ) { - size_t length; - const char *s; + if ( _Objects_Has_string_name( information ) ) { + size_t length; + char *dup; - s = name; - length = strnlen( name, information->name_length ); + length = strnlen( name, information->name_length ); + dup = _Workspace_String_duplicate( name, length ); + if ( dup == NULL ) { + return false; + } - if ( information->is_string ) { - char *d; + the_object->name.name_p = dup; + } else { + char c[ 4 ]; + size_t i; - d = _Workspace_Allocate( length + 1 ); - if ( !d ) - return false; + memset( c, ' ', sizeof( c ) ); - _Workspace_Free( (void *)the_object->name.name_p ); - the_object->name.name_p = NULL; + for ( i = 0; i < 4; ++i ) { + if ( name[ i ] == '\0') { + break; + } - strncpy( d, name, length ); - d[length] = '\0'; - the_object->name.name_p = d; - } else { - the_object->name.name_u32 = _Objects_Build_name( - ((length) ? s[ 0 ] : ' '), - ((length > 1) ? s[ 1 ] : ' '), - ((length > 2) ? s[ 2 ] : ' '), - ((length > 3) ? s[ 3 ] : ' ') - ); + c[ i ] = name[ i ]; + } + + the_object->name.name_u32 = + _Objects_Build_name( c[ 0 ], c[ 1 ], c[ 2 ], c[ 3 ] ); } return true; diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index b63a6b14cd..5c27ee00ef 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -58,8 +58,7 @@ void _Thread_Initialize_information( the_class, maximum, _Thread_Control_size, - false, - RTEMS_MAXIMUM_NAME_LENGTH, + OBJECTS_NO_STRING_NAME, NULL ); |