mempool: Add k_mem_pool_free_id API

The k_mem_pool_free API has no use for the full k_mem_block struct. In
particular, it only needs the k_mem_block_id. Introduce a new API
which takes only this essential struct. This paves the way to
simplify & improve the k_malloc/k_free implementation a bit.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-01-11 20:45:27 +02:00 committed by Anas Nashif
commit 7d887cb615
2 changed files with 21 additions and 5 deletions

View file

@ -3660,6 +3660,18 @@ extern int k_mem_pool_alloc(struct k_mem_pool *pool, struct k_mem_block *block,
*/
extern void k_mem_pool_free(struct k_mem_block *block);
/**
* @brief Free memory allocated from a memory pool.
*
* This routine releases a previously allocated memory block back to its
* memory pool
*
* @param id Memory block identifier.
*
* @return N/A
*/
extern void k_mem_pool_free_id(struct k_mem_block_id *id);
/**
* @} end addtogroup mem_pool_apis
*/