[rtems commit] score: Remove Objects_Information::the_api

Sebastian Huber sebh at rtems.org
Fri Dec 7 13:33:23 UTC 2018


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sun Nov 25 20:26:02 2018 +0100

score: Remove Objects_Information::the_api

Remove Objects_Information::the_class.  This information is already
contained in Objects_Information::maximum_id.

Update #3621.

---

 cpukit/include/rtems/score/objectimpl.h        |  4 ----
 cpukit/score/src/objectextendinformation.c     | 18 ++++++------------
 cpukit/score/src/objectinitializeinformation.c |  8 ++++++--
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h
index cf670b9..e32533c 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -137,10 +137,6 @@ typedef struct {
    * (OBJECTS_NO_STRING_NAME).
    */
   uint16_t          name_length;
-  /** This field indicates the API of this object class. */
-  uint8_t           the_api;
-  /** This is the class of this object set. */
-  uint8_t           the_class;
   /** This is the true if unlimited objects in this class. */
   bool              auto_extend;
   /** This is the chain of inactive control blocks. */
diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index 57ce673..4e55bbc 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -54,12 +54,14 @@ void _Objects_Extend_information(
   size_t            object_block_size;
   Objects_Control  *new_object_block;
   bool              do_extend;
+  Objects_Id        api_class_and_node;
 
   _Assert(
     _Objects_Allocator_is_owner()
       || !_System_state_Is_up( _System_state_Get() )
   );
 
+  api_class_and_node = information->maximum_id & ~OBJECTS_INDEX_MASK;
   old_maximum = _Objects_Get_maximum_index( information );
 
   /*
@@ -218,12 +220,8 @@ void _Objects_Extend_information(
     information->object_blocks = object_blocks;
     information->inactive_per_block = inactive_per_block;
     information->local_table = local_table;
-    information->maximum_id = _Objects_Build_id(
-      information->the_api,
-      information->the_class,
-      _Objects_Local_node,
-      new_maximum
-    );
+    information->maximum_id = api_class_and_node
+      | (new_maximum << OBJECTS_INDEX_START_BIT);
 
     _ISR_lock_ISR_enable( &lock_context );
 
@@ -244,12 +242,8 @@ void _Objects_Extend_information(
    */
   the_object = new_object_block;
   for ( index = index_base ; index < index_end ; ++index ) {
-    the_object->id = _Objects_Build_id(
-      information->the_api,
-      information->the_class,
-      _Objects_Local_node,
-      index + OBJECTS_INDEX_MINIMUM
-    );
+    the_object->id = api_class_and_node
+      | ( ( index + OBJECTS_INDEX_MINIMUM ) << OBJECTS_INDEX_START_BIT );
 
     _Chain_Initialize_node( &the_object->Node );
     _Chain_Append_unprotected( &information->Inactive, &the_object->Node );
diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c
index c1327ae..d51d5cf 100644
--- a/cpukit/score/src/objectinitializeinformation.c
+++ b/cpukit/score/src/objectinitializeinformation.c
@@ -39,8 +39,12 @@ void _Objects_Do_initialize_information(
 {
   Objects_Maximum maximum_per_allocation;
 
-  information->the_api     = the_api;
-  information->the_class   = the_class;
+  information->maximum_id = _Objects_Build_id(
+    the_api,
+    the_class,
+    _Objects_Local_node,
+    0
+  );
   information->object_size = object_size;
 
   /*



More information about the vc mailing list