From dac340dd663bdfed29470c1327a2e7d10dbfa002 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 12 Dec 2014 11:19:10 +0100 Subject: posix: Simplify _POSIX_Keys_Find() --- cpukit/posix/include/rtems/posix/keyimpl.h | 13 +++++++------ cpukit/posix/src/keyfreememory.c | 3 +-- cpukit/posix/src/keygetspecific.c | 3 +-- cpukit/posix/src/keysetspecific.c | 3 +-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cpukit/posix/include/rtems/posix/keyimpl.h b/cpukit/posix/include/rtems/posix/keyimpl.h index 42989b0c16..1dcfb4e9c6 100644 --- a/cpukit/posix/include/rtems/posix/keyimpl.h +++ b/cpukit/posix/include/rtems/posix/keyimpl.h @@ -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 ); diff --git a/cpukit/posix/src/keyfreememory.c b/cpukit/posix/src/keyfreememory.c index 4e19832827..9f03f6bd7e 100644 --- a/cpukit/posix/src/keyfreememory.c +++ b/cpukit/posix/src/keyfreememory.c @@ -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; /** diff --git a/cpukit/posix/src/keygetspecific.c b/cpukit/posix/src/keygetspecific.c index 5ab37a7553..ef6c19d56c 100644 --- a/cpukit/posix/src/keygetspecific.c +++ b/cpukit/posix/src/keygetspecific.c @@ -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; diff --git a/cpukit/posix/src/keysetspecific.c b/cpukit/posix/src/keysetspecific.c index 8e4b3a43ca..427fff3d03 100644 --- a/cpukit/posix/src/keysetspecific.c +++ b/cpukit/posix/src/keysetspecific.c @@ -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 ); -- cgit v1.2.3