[PATCH 20/21] score: Add _Objects_Activate_unlimited()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Dec 16 14:28:25 UTC 2019


Update #3835.
---
 cpukit/include/rtems/score/objectimpl.h    | 24 ++++++++++++++++++++++++
 cpukit/score/src/objectallocateunlimited.c | 13 +------------
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h
index e5d5347895..8bc4545670 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -936,6 +936,30 @@ RTEMS_INLINE_ROUTINE void _Objects_Free(
   ( *information->free )( information, the_object );
 }
 
+/**
+ * @brief Activate the object.
+ *
+ * This function must be only used in case this objects information supports
+ * unlimited objects.
+ *
+ * @param information The object information block.
+ * @param the_object The object to activate.
+ */
+RTEMS_INLINE_ROUTINE void _Objects_Activate_unlimited(
+  Objects_Maximum objects_per_block;
+  Objects_Maximum block;
+
+  objects_per_block = information->objects_per_block;
+  block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
+
+  if ( block > objects_per_block ) {
+    block /= objects_per_block;
+
+    information->inactive_per_block[ block ]--;
+    information->inactive--;
+  }
+}
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/objectallocateunlimited.c b/cpukit/score/src/objectallocateunlimited.c
index 92727e1411..6ec4a7950b 100644
--- a/cpukit/score/src/objectallocateunlimited.c
+++ b/cpukit/score/src/objectallocateunlimited.c
@@ -61,18 +61,7 @@ Objects_Control *_Objects_Allocate_unlimited( Objects_Information *information )
   }
 
   if ( the_object != NULL ) {
-    Objects_Maximum objects_per_block;
-    Objects_Maximum block;
-
-    objects_per_block = information->objects_per_block;
-    block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM;
-
-    if ( block > objects_per_block ) {
-      block /= objects_per_block;
-
-      information->inactive_per_block[ block ]--;
-      information->inactive--;
-    }
+    _Objects_Activate_unlimited( information, the_object );
   }
 
   return the_object;
-- 
2.16.4



More information about the devel mailing list