diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 22:57:43 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-01-23 22:57:43 +0000 |
commit | ce19f1fa3bd9f9760f680ef7839ca136a1c2478a (patch) | |
tree | aa2c0b50ec70dd5c9e8d970aaa7c8deba8fcf330 /cpukit/score | |
parent | 2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-ce19f1fa3bd9f9760f680ef7839ca136a1c2478a.tar.bz2 |
2008-01-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/Makefile.am | 8 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/object.h | 98 | ||||
-rw-r--r-- | cpukit/score/inline/rtems/score/object.inl | 72 | ||||
-rw-r--r-- | cpukit/score/src/apimutexallocate.c | 3 | ||||
-rw-r--r-- | cpukit/score/src/objectclearname.c | 50 | ||||
-rw-r--r-- | cpukit/score/src/objectcomparenameraw.c | 61 | ||||
-rw-r--r-- | cpukit/score/src/objectcomparenamestring.c | 57 | ||||
-rw-r--r-- | cpukit/score/src/objectcopynameraw.c | 50 | ||||
-rw-r--r-- | cpukit/score/src/objectcopynamestring.c | 53 | ||||
-rw-r--r-- | cpukit/score/src/objectextendinformation.c | 14 | ||||
-rw-r--r-- | cpukit/score/src/objectgetnameasstring.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/objectmp.c | 4 | ||||
-rw-r--r-- | cpukit/score/src/objectnametoid.c | 18 |
13 files changed, 114 insertions, 380 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 3440af7090..f5aae2d610 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -113,11 +113,9 @@ libscore_a_SOURCES += src/heap.c src/heapallocate.c src/heapextend.c \ ## OBJECT_C_FILES libscore_a_SOURCES += src/object.c src/objectallocate.c \ - src/objectclearname.c src/objectcomparenameraw.c \ - src/objectcomparenamestring.c src/objectcopynameraw.c \ - src/objectcopynamestring.c src/objectextendinformation.c \ - src/objectfree.c src/objectget.c src/objectgetisr.c src/objectgetnext.c \ - src/objectinitializeinformation.c src/objectnametoid.c \ + src/objectextendinformation.c src/objectfree.c src/objectget.c \ + src/objectgetisr.c src/objectgetnext.c src/objectinitializeinformation.c \ + src/objectnametoid.c src/objectnametoidstring.c \ src/objectshrinkinformation.c src/objectgetnoprotection.c \ src/objectidtoname.c src/objectgetnameasstring.c diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index 9b328a67a3..7ed0a8300b 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -33,7 +33,12 @@ extern "C" { * The following type defines the control block used to manage * object names. */ -typedef void * Objects_Name; +typedef union { + /** This is a pointer to a string name. */ + const char *name_p; + /** This is the actual 32-bit "raw" integer name. */ + uint32_t name_u32; +} Objects_Name; /** * Space for object names is allocated in multiples of this. @@ -337,7 +342,8 @@ typedef struct { /** This points to the table of local objects. */ Objects_Control **local_table; /** This points to the table of local object names. */ - Objects_Name *name_table; + /* XXX should be safe to remove this field */ + uint32_t **name_table; /** This is the chain of inactive control blocks. */ Chain_Control Inactive; /** This is the number of objects on the Inactive list. */ @@ -533,69 +539,6 @@ void _Objects_Free( ); /** - * This method zeroes out the name. - * - * @param[in] name points to the name to be zeroed out. - * @param[in] length is the length of the object name field. - */ -void _Objects_Clear_name( - void *name, - const size_t length -); - -/** - * This method copies a string style object name from source to destination. - * - * @param[in] source is the source name to copy. - * @param[in] destination is the destination of the copy. - * @param[in] length is the number of bytes to copy. - */ -void _Objects_Copy_name_string( - const void *source, - void *destination, - const size_t length -); - -/** - * This method copies a raw style object name from source to destination. - * - * @param[in] source is the source name to copy. - * @param[in] destination is the destination of the copy. - * @param[in] length is the number of bytes to copy. - */ -void _Objects_Copy_name_raw( - const void *source, - void *destination, - const size_t length -); - -/** - * This method compares two string style object names. - * - * @param[in] name_1 is the left hand name to compare. - * @param[in] name_2 is the right hand name to compare. - * @param[in] length is the length of the names to compare. - */ -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - uint16_t length -); - -/** - * This method compares two raw style object names. - * - * @param[in] name_1 is the left hand name to compare. - * @param[in] name_2 is the right hand name to compare. - * @param[in] length is the length of the names to compare. - */ -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - uint16_t length -); - -/** * This function implements the common portion of the object * identification directives. This directive returns the object * id associated with name. If more than one object of this class @@ -637,9 +580,30 @@ typedef enum { * successful or failure. On success @a id will contain the Id of * the requested object. */ -Objects_Name_or_id_lookup_errors _Objects_Name_to_id( +Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( + Objects_Information *information, + uint32_t name, + uint32_t node, + Objects_Id *id +); + +/** + * This method converts an object name to an Id. It performs a look up + * using the object information block for this object class. + * + * @param[in] information points to an object class information block. + * @param[in] name is the name of the object to find. + * @param[in] node is the set of nodes to search. + * @param[in] id will contain the Id if the search is successful. + * + * @return This method returns one of the values from the + * @ref Objects_Name_or_id_lookup_errors enumeration to indicate + * successful or failure. On success @a id will contain the Id of + * the requested object. + */ +Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string( Objects_Information *information, - Objects_Name name, + const char *name, uint32_t node, Objects_Id *id ); 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 diff --git a/cpukit/score/src/apimutexallocate.c b/cpukit/score/src/apimutexallocate.c index 627a33dae4..4d96868cb3 100644 --- a/cpukit/score/src/apimutexallocate.c +++ b/cpukit/score/src/apimutexallocate.c @@ -21,6 +21,7 @@ void _API_Mutex_Allocate( ) { API_Mutex_Control *mutex; + CORE_mutex_Attributes attr = { CORE_MUTEX_NESTING_IS_ERROR, FALSE, @@ -32,7 +33,7 @@ void _API_Mutex_Allocate( _CORE_mutex_Initialize( &mutex->Mutex, &attr, CORE_MUTEX_UNLOCKED ); - _Objects_Open( &_API_Mutex_Information, &mutex->Object, (Objects_Name) 1 ); + _Objects_Open_u32( &_API_Mutex_Information, &mutex->Object, 1 ); *the_mutex = mutex; } diff --git a/cpukit/score/src/objectclearname.c b/cpukit/score/src/objectclearname.c deleted file mode 100644 index f0845810ab..0000000000 --- a/cpukit/score/src/objectclearname.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Clear_name - * - * This method clears the specified name so that no caller can do a name to - * ID/object lookup past this point. - */ - -void _Objects_Clear_name( - void *name, - const size_t length -) -{ - size_t index; - size_t maximum = length / OBJECTS_NAME_ALIGNMENT; - uint32_t *name_ptr = (uint32_t *) name; - - for ( index=0 ; index < maximum ; index++ ) - *name_ptr++ = 0; -} diff --git a/cpukit/score/src/objectcomparenameraw.c b/cpukit/score/src/objectcomparenameraw.c deleted file mode 100644 index 870d55d651..0000000000 --- a/cpukit/score/src/objectcomparenameraw.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Compare_name_raw - * - * XXX - */ - -boolean _Objects_Compare_name_raw( - void *name_1, - void *name_2, - uint16_t length -) -{ -#if 0 - uint32_t *name_1_p = (uint32_t *) name_1; - uint32_t *name_2_p = (uint32_t *) name_2; - uint32_t tmp_length = length / OBJECTS_NAME_ALIGNMENT; -#endif - - if ( name_1 == name_2 ) - return TRUE; - return FALSE; - -#if 0 - while ( tmp_length-- ) - if ( *name_1_p++ != *name_2_p++ ) - return FALSE; - - return TRUE; -#endif -} diff --git a/cpukit/score/src/objectcomparenamestring.c b/cpukit/score/src/objectcomparenamestring.c deleted file mode 100644 index a9b3be1e7b..0000000000 --- a/cpukit/score/src/objectcomparenamestring.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-2002. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -#include <string.h> - -/*PAGE - * - * _Objects_Compare_name_string - * - * This routine compares the name of an object with the specified string. - * - * Input parameters: - * name_1 - one name - * name_2 - other name - * length - maximum length to compare - * - * Output parameters: - * returns - TRUE on a match - */ - -boolean _Objects_Compare_name_string( - void *name_1, - void *name_2, - uint16_t length -) -{ - if ( !strncmp( name_1, name_2, length ) ) - return TRUE; - return FALSE; -} diff --git a/cpukit/score/src/objectcopynameraw.c b/cpukit/score/src/objectcopynameraw.c deleted file mode 100644 index 5534323a4c..0000000000 --- a/cpukit/score/src/objectcopynameraw.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Copy_name_raw - * - * XXX - */ - -void _Objects_Copy_name_raw( - const void *source, - void *destination, - const size_t length -) -{ - uint32_t *source_p = (uint32_t *) source; - uint32_t *destination_p = (uint32_t *) destination; - size_t tmp_length = length / OBJECTS_NAME_ALIGNMENT; - - while ( tmp_length-- ) - *destination_p++ = *source_p++; -} diff --git a/cpukit/score/src/objectcopynamestring.c b/cpukit/score/src/objectcopynamestring.c deleted file mode 100644 index 764e9aa172..0000000000 --- a/cpukit/score/src/objectcopynamestring.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Object Handler - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/system.h> -#include <rtems/score/address.h> -#include <rtems/score/chain.h> -#include <rtems/score/object.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/objectmp.h> -#endif -#include <rtems/score/thread.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/sysstate.h> -#include <rtems/score/isr.h> - -/*PAGE - * - * _Objects_Copy_name_string - * - * XXX - */ - -void _Objects_Copy_name_string( - const void *source, - void *destination, - const size_t length -) -{ - uint8_t *source_p = (uint8_t *) source; - uint8_t *destination_p = (uint8_t *) destination; - - *destination_p = '\0'; - if ( source_p ) { - do { - *destination_p++ = *source_p; - } while ( *source_p++ ); - } -} diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c index 538ab139bb..8db0bf5b9b 100644 --- a/cpukit/score/src/objectextendinformation.c +++ b/cpukit/score/src/objectextendinformation.c @@ -84,7 +84,7 @@ void _Objects_Extend_information( if (index_base >= information->maximum ) { ISR_Level level; void **object_blocks; - Objects_Name *name_table; + void **name_table; uint32_t *inactive_per_block; Objects_Control **local_table; uint32_t maximum; @@ -147,7 +147,7 @@ void _Objects_Extend_information( inactive_per_block = (uint32_t *) _Addresses_Add_offset( object_blocks, block_count * sizeof(void*) ); - name_table = (Objects_Name *) _Addresses_Add_offset( + name_table = (void *) _Addresses_Add_offset( inactive_per_block, block_count * sizeof(uint32_t ) ); local_table = (Objects_Control **) _Addresses_Add_offset( name_table, block_count * sizeof(Objects_Name *) ); @@ -195,7 +195,7 @@ void _Objects_Extend_information( object_blocks[block_count] = NULL; inactive_per_block[block_count] = 0; - name_table[block_count] = NULL; + // name_table[block_count] = NULL; for ( index=index_base ; index < ( information->allocation_size + index_base ); @@ -209,7 +209,7 @@ void _Objects_Extend_information( information->object_blocks = object_blocks; information->inactive_per_block = inactive_per_block; - information->name_table = name_table; + information->name_table = (void *)name_table; information->local_table = local_table; information->maximum = maximum; information->maximum_id = _Objects_Build_id( @@ -253,7 +253,7 @@ void _Objects_Extend_information( information->object_blocks[ block ], (information->allocation_size * information->size) ); - information->name_table[ block ] = name_area; + // information->name_table[ block ] = name_area; /* * Initialize objects .. add to a local chain first. @@ -281,9 +281,7 @@ void _Objects_Extend_information( index ); - the_object->name = (void *) name_area; - - name_area = _Addresses_Add_offset( name_area, information->name_length ); + name_area = (void *)_Addresses_Add_offset( name_area, information->name_length ); _Chain_Append( &information->Inactive, &the_object->Node ); diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c index a8b72c9d98..e19059ffd8 100644 --- a/cpukit/score/src/objectgetnameasstring.c +++ b/cpukit/score/src/objectgetnameasstring.c @@ -35,7 +35,7 @@ char *_Objects_Get_name_as_string( ) { Objects_Information *information; - char *s; + const char *s; char *d; uint32_t i; char lname[5]; @@ -65,9 +65,9 @@ char *_Objects_Get_name_as_string( case OBJECTS_LOCAL: if ( information->is_string ) { - s = the_object->name; + s = the_object->name.name_p; } else { - uint32_t u32_name = (uint32_t) the_object->name; + uint32_t u32_name = (uint32_t) the_object->name.name_u32; lname[ 0 ] = (u32_name >> 24) & 0xff; lname[ 1 ] = (u32_name >> 16) & 0xff; diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c index 1eb678557a..dae942cb63 100644 --- a/cpukit/score/src/objectmp.c +++ b/cpukit/score/src/objectmp.c @@ -192,7 +192,7 @@ Objects_Name_or_id_lookup_errors _Objects_MP_Global_name_search ( /* * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. + * _Objects_Name_to_id_XXX before this was invoked. */ if ( !_Objects_Is_local_node( node_index ) ) { @@ -239,7 +239,7 @@ void _Objects_MP_Is_remote ( /* * NOTE: The local node was search (if necessary) by - * _Objects_Name_to_id before this was invoked. + * _Objects_Name_to_id_XXX before this was invoked. * * The NODE field of an object id cannot be 0 * because 0 is an invalid node number. diff --git a/cpukit/score/src/objectnametoid.c b/cpukit/score/src/objectnametoid.c index 03e9d1da28..cc523e17b9 100644 --- a/cpukit/score/src/objectnametoid.c +++ b/cpukit/score/src/objectnametoid.c @@ -2,7 +2,7 @@ * Object Handler * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -30,7 +30,7 @@ /*PAGE * - * _Objects_Name_to_id + * _Objects_Name_to_id_u32 * * These kernel routines search the object table(s) for the given * object name and returns the associated object id. @@ -47,9 +47,9 @@ * error code - if unsuccessful */ -Objects_Name_or_id_lookup_errors _Objects_Name_to_id( +Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32( Objects_Information *information, - Objects_Name name, + uint32_t name, uint32_t node, Objects_Id *id ) @@ -58,7 +58,8 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id( Objects_Control *the_object; uint32_t index; uint32_t name_length; - Objects_Name_comparators compare_them; + + /* ASSERT: information->is_string == FALSE */ if ( !id ) return OBJECTS_INVALID_ADDRESS; @@ -78,15 +79,12 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id( if ( search_local_node ) { name_length = information->name_length; - if ( information->is_string ) compare_them = _Objects_Compare_name_string; - else compare_them = _Objects_Compare_name_raw; - for ( index = 1; index <= information->maximum; index++ ) { the_object = information->local_table[ index ]; - if ( !the_object || !the_object->name ) + if ( !the_object ) continue; - if ( (*compare_them)( name, the_object->name, name_length ) ) { + if ( name == the_object->name.name_u32 ) { *id = the_object->id; return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL; } |