summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-08 11:21:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-31 17:30:17 +0200
commit91c811a132696e10efca58f138e7af08a360ad71 (patch)
tree78fdbd1803041029b26ea20f46104fb8a133b974
parent5bb93f22fc685125fa801592c90e7c96b23cd9ef (diff)
downloadrtems-91c811a132696e10efca58f138e7af08a360ad71.tar.bz2
score: Add _Freechain_Push()
Update #3959.
-rw-r--r--cpukit/include/rtems/score/freechain.h19
-rw-r--r--cpukit/score/src/freechain.c3
2 files changed, 18 insertions, 4 deletions
diff --git a/cpukit/include/rtems/score/freechain.h b/cpukit/include/rtems/score/freechain.h
index eaee077366..ab1e8150da 100644
--- a/cpukit/include/rtems/score/freechain.h
+++ b/cpukit/include/rtems/score/freechain.h
@@ -92,9 +92,9 @@ RTEMS_INLINE_ROUTINE bool _Freechain_Is_empty(
}
/**
- * @brief Pop an item from the freechain.
+ * @brief Pops a node from the freechain.
*
- * The freechain must not be empty.
+ * The freechain shall not be empty.
*
* @param freechain The freechain control.
*/
@@ -104,6 +104,21 @@ RTEMS_INLINE_ROUTINE void *_Freechain_Pop( Freechain_Control *freechain )
}
/**
+ * @brief Pushes a node back to the freechain.
+ *
+ * @param freechain The freechain control.
+ * @param node The node to push back. The node shall not be @c NULL.
+ */
+void RTEMS_INLINE_ROUTINE _Freechain_Push(
+ Freechain_Control *freechain,
+ void *node
+)
+{
+ _Chain_Initialize_node( node );
+ _Chain_Prepend_unprotected( &freechain->Free, node );
+}
+
+/**
* @brief Extend the freechain with new nodes.
*
* @param freechain The freechain control.
diff --git a/cpukit/score/src/freechain.c b/cpukit/score/src/freechain.c
index 7f60c655db..209a2b780d 100644
--- a/cpukit/score/src/freechain.c
+++ b/cpukit/score/src/freechain.c
@@ -67,7 +67,6 @@ void *_Freechain_Get(
void _Freechain_Put( Freechain_Control *freechain, void *node )
{
if ( node != NULL ) {
- _Chain_Initialize_node( node );
- _Chain_Prepend_unprotected( &freechain->Free, node );
+ _Freechain_Push( freechain, node );
}
}