From ce19f1fa3bd9f9760f680ef7839ca136a1c2478a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 23 Jan 2008 22:57:43 +0000 Subject: 2008-01-23 Joel Sherrill * itron/include/rtems/itron/object.h, itron/src/cre_tsk.c, libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c, libmisc/capture/capture.c, libmisc/monitor/mon-manager.c, libmisc/stackchk/check.c, posix/src/condinit.c, posix/src/keycreate.c, posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c, posix/src/mqueueopen.c, posix/src/mqueueunlink.c, posix/src/mutexinit.c, posix/src/pbarrierinit.c, posix/src/prwlockinit.c, posix/src/pspininit.c, posix/src/pthreadcreate.c, posix/src/pthreadexit.c, posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c, posix/src/timercreate.c, rtems/src/barrierident.c, rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c, rtems/src/ratemonident.c, rtems/src/regionident.c, rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c, sapi/src/extensionident.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/src/apimutexallocate.c, score/src/objectextendinformation.c, score/src/objectgetnameasstring.c, score/src/objectmp.c, score/src/objectnametoid.c: Convert the Objects_Name type from a simple type to a union of an unsigned 32 bit integer and a pointer. This should help eliminate weird casts between u32 and pointers in various places. The APIs now have to explicitly call _u32 or _string versions of helper routines. This should also simplify things and eliminate the need for ugly casts in some cases. * score/src/objectclearname.c, score/src/objectcomparenameraw.c, score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c, score/src/objectcopynamestring.c: Removed. --- cpukit/score/inline/rtems/score/object.inl | 72 ++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 13 deletions(-) (limited to 'cpukit/score/inline') diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl index 32105ddba2..f541220270 100644 --- a/cpukit/score/inline/rtems/score/object.inl +++ b/cpukit/score/inline/rtems/score/object.inl @@ -289,12 +289,53 @@ RTEMS_INLINE_ROUTINE void _Objects_Open( index = _Objects_Get_index( the_object->id ); _Objects_Set_local_object( information, index, the_object ); - if ( information->is_string ) - /* _Objects_Copy_name_string( name, the_object->name ); */ - the_object->name = name; - else - /* _Objects_Copy_name_raw( name, the_object->name, information->name_length ); */ - the_object->name = name; + the_object->name = name; +} + +/** + * This function places the_object control pointer and object name + * in the Local Pointer and Local Name Tables, respectively. + * + * @param[in] information points to an Object Information Table + * @param[in] the_object is a pointer to an object + * @param[in] name is the name of the object to make accessible + */ +RTEMS_INLINE_ROUTINE void _Objects_Open_u32( + Objects_Information *information, + Objects_Control *the_object, + uint32_t name +) +{ + uint32_t index; + + index = _Objects_Get_index( the_object->id ); + _Objects_Set_local_object( information, index, the_object ); + + /* ASSERT: information->is_string == FALSE */ + the_object->name.name_u32 = name; +} + +/** + * This function places the_object control pointer and object name + * in the Local Pointer and Local Name Tables, respectively. + * + * @param[in] information points to an Object Information Table + * @param[in] the_object is a pointer to an object + * @param[in] name is the name of the object to make accessible + */ +RTEMS_INLINE_ROUTINE void _Objects_Open_string( + Objects_Information *information, + Objects_Control *the_object, + const char *name +) +{ + uint32_t index; + + index = _Objects_Get_index( the_object->id ); + _Objects_Set_local_object( information, index, the_object ); + + /* information->is_string */ + the_object->name.name_p = name; } /** @@ -309,12 +350,14 @@ RTEMS_INLINE_ROUTINE void _Objects_Close( Objects_Control *the_object ) { - uint32_t index; + _Objects_Set_local_object( + information, + _Objects_Get_index( the_object->id ), + NULL + ); - index = _Objects_Get_index( the_object->id ); - _Objects_Set_local_object( information, index, NULL ); - /* _Objects_Clear_name( the_object->name, information->name_length ); */ - the_object->name = 0; + the_object->name.name_u32 = 0; + the_object->name.name_p = NULL; } /** @@ -328,8 +371,11 @@ RTEMS_INLINE_ROUTINE void _Objects_Namespace_remove( Objects_Control *the_object ) { - /* _Objects_Clear_name( the_object->name, information->name_length ); */ - the_object->name = 0; + /* + * Clear out either format. + */ + the_object->name.name_p = NULL; + the_object->name.name_u32 = 0; } #endif -- cgit v1.2.3