mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-26 11:58:45 +08:00
posix: Simplify _POSIX_Keys_Find()
This commit is contained in:
@@ -169,17 +169,18 @@ RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_pair_free(
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE RBTree_Node *_POSIX_Keys_Find(
|
||||
pthread_key_t key,
|
||||
Thread_Control *thread,
|
||||
POSIX_Keys_Key_value_pair *search_node
|
||||
pthread_key_t key,
|
||||
Thread_Control *thread
|
||||
)
|
||||
{
|
||||
search_node->key = key;
|
||||
search_node->thread = thread;
|
||||
POSIX_Keys_Key_value_pair search_node;
|
||||
|
||||
search_node.key = key;
|
||||
search_node.thread = thread;
|
||||
|
||||
return _RBTree_Find(
|
||||
&_POSIX_Keys_Key_value_lookup_tree,
|
||||
&search_node->Key_value_lookup_node,
|
||||
&search_node.Key_value_lookup_node,
|
||||
_POSIX_Keys_Key_value_compare,
|
||||
true
|
||||
);
|
||||
|
||||
@@ -26,13 +26,12 @@ void _POSIX_Keys_Free_memory(
|
||||
POSIX_Keys_Control *the_key
|
||||
)
|
||||
{
|
||||
POSIX_Keys_Key_value_pair search_node;
|
||||
POSIX_Keys_Key_value_pair *p;
|
||||
RBTree_Node *iter, *next;
|
||||
Objects_Id key_id;
|
||||
|
||||
key_id = the_key->Object.id;
|
||||
iter = _POSIX_Keys_Find( key_id, 0, &search_node );
|
||||
iter = _POSIX_Keys_Find( key_id, 0 );
|
||||
if ( !iter )
|
||||
return;
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,6 @@ void *pthread_getspecific(
|
||||
{
|
||||
POSIX_Keys_Control *the_key;
|
||||
Objects_Locations location;
|
||||
POSIX_Keys_Key_value_pair search_node;
|
||||
RBTree_Node *p;
|
||||
void *key_data;
|
||||
POSIX_Keys_Key_value_pair *value_pair_p;
|
||||
@@ -49,7 +48,7 @@ void *pthread_getspecific(
|
||||
switch ( location ) {
|
||||
|
||||
case OBJECTS_LOCAL:
|
||||
p = _POSIX_Keys_Find( key, _Thread_Executing, &search_node );
|
||||
p = _POSIX_Keys_Find( key, _Thread_Executing );
|
||||
if ( p != NULL ) {
|
||||
value_pair_p = POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( p );
|
||||
key_data = value_pair_p->value;
|
||||
|
||||
@@ -38,7 +38,6 @@ int pthread_setspecific(
|
||||
Objects_Locations location;
|
||||
POSIX_Keys_Key_value_pair *value_pair_ptr;
|
||||
RBTree_Node *p;
|
||||
POSIX_Keys_Key_value_pair search_node;
|
||||
Thread_Control *executing;
|
||||
|
||||
the_key = _POSIX_Keys_Get( key, &location );
|
||||
@@ -46,7 +45,7 @@ int pthread_setspecific(
|
||||
|
||||
case OBJECTS_LOCAL:
|
||||
executing = _Thread_Executing;
|
||||
p = _POSIX_Keys_Find( key, executing, &search_node );
|
||||
p = _POSIX_Keys_Find( key, executing );
|
||||
if ( p != NULL ) {
|
||||
value_pair_ptr = POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( p );
|
||||
value_pair_ptr->value = RTEMS_DECONST( void *, value );
|
||||
|
||||
Reference in New Issue
Block a user