diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-31 16:15:34 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-31 16:15:34 +0000 |
commit | 74d0cb441aee70c3bc87032fbac23ea4b7437b8b (patch) | |
tree | 167bdb4ddccfb3a3c65b1b590348bde2af8dba0c /cpukit/score/src/objectsetname.c | |
parent | 2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-74d0cb441aee70c3bc87032fbac23ea4b7437b8b.tar.bz2 |
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
* posix/src/cond.c, posix/src/key.c, posix/src/mqueuenametoid.c,
posix/src/mutex.c, posix/src/pbarrier.c, posix/src/prwlock.c,
posix/src/pspin.c, posix/src/pthread.c, posix/src/ptimer.c,
posix/src/semaphorenametoid.c: Add option for all POSIX objects
whether named or unnamed to have a string name. If the API does
not directly support having a name, then the user must explicitly
assign it using rtems_object_set_name().
* rtems/src/rtemsobjectgetapiclassname.c: Improved testability.
* score/include/rtems/score/object.h,
score/src/objectgetnameasstring.c, score/src/objectnametoidstring.c,
score/src/objectsetname.c: Modifications required to pass testing of
recently modified object name operations. Also eliminated
multiprocessing related code that was not reachable.
Diffstat (limited to 'cpukit/score/src/objectsetname.c')
-rw-r--r-- | cpukit/score/src/objectsetname.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c index 455b4b51c3..727b9836eb 100644 --- a/cpukit/score/src/objectsetname.c +++ b/cpukit/score/src/objectsetname.c @@ -47,26 +47,21 @@ boolean _Objects_Set_name( if ( !d ) return FALSE; - if ( the_object->name.name_p ) + if ( the_object->name.name_p ) { _Workspace_Free( (void *)the_object->name.name_p ); - - the_object->name.name_p = NULL; + the_object->name.name_p = NULL; + } strncpy( d, name, length ); the_object->name.name_p = d; } else { - uint32_t name_u32 = 0; - char lname[5] = " "; - int i; - - for ( i=0 ; i<4 && i<length ; i++ ) - lname[ i ] = s[ i ]; + the_object->name.name_u32 = _Objects_Build_name( + ((0<length) ? s[ 0 ] : ' '), + ((1<length) ? s[ 1 ] : ' '), + ((2<length) ? s[ 2 ] : ' '), + ((3<length) ? s[ 3 ] : ' ') + ); - name_u32 |= ((uint32_t)lname[ 0 ] << 24); - name_u32 |= ((uint32_t)lname[ 1 ] << 16); - name_u32 |= ((uint32_t)lname[ 2 ] << 8); - name_u32 |= (uint32_t)lname[ 3 ]; - the_object->name.name_u32 = name_u32; } return TRUE; |