The Freechain Handler is used to manage a chain of nodes, of which size can automatically increase when there is no free node left.
More...
The Freechain Handler is used to manage a chain of nodes, of which size can automatically increase when there is no free node left.
This handler provides one data structure: Freechain_Control.
◆ _Freechain_Get()
Gets a node from the freechain.
- Parameters
-
[in] | freechain | The freechain control. |
[in] | allocator | The allocator function. |
[in] | number_nodes_to_extend | The number of nodes in case an extend is necessary due to an empty freechain. |
[in] | node_size | The node size. |
- Return values
-
NULL | The freechain is empty and the extend operation failed. |
otherwise | Pointer to a node. The node ownership passes to the caller. |
References _Assert, _Chain_Get_unprotected(), _Chain_Initialize(), _Chain_Is_empty(), and Freechain_Control::Free.
◆ _Freechain_Initialize()
Initializes a freechain.
This routine initializes the freechain control structure to manage a chain of nodes. In case the freechain is empty the extend handler is called to get more nodes.
- Parameters
-
[in] | freechain | The freechain control to initialize. |
[in] | allocator | The allocator function. |
[in] | number_nodes | The initial number of nodes. |
[in] | node_size | The node size. |
References _Chain_Initialize(), and Freechain_Control::Free.
◆ _Freechain_Put()