[rtems commit] posix: Simplify _POSIX_Keys_Find()

Sebastian Huber sebh at rtems.org
Fri Dec 12 12:18:48 UTC 2014


Module:    rtems
Branch:    master
Commit:    dac340dd663bdfed29470c1327a2e7d10dbfa002
Changeset: http://git.rtems.org/rtems/commit/?id=dac340dd663bdfed29470c1327a2e7d10dbfa002

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Dec 12 11:19:10 2014 +0100

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 42989b0..1dcfb4e 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 4e19832..9f03f6b 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 5ab37a7..ef6c19d 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 8e4b3a4..427fff3 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 );




More information about the vc mailing list