From 6e8177dae93f592b1d39cd6d6e77c9e6f254360f Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 25 Oct 2024 23:02:31 -0500 Subject: core: add documentation comments to API functions Add documentation comments to the functions and structures exposed through the Rune API. Signed-off-by: Danny Holman --- include/rune/core/alloc.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include/rune/core/alloc.h') diff --git a/include/rune/core/alloc.h b/include/rune/core/alloc.h index 35170d8..65121ce 100644 --- a/include/rune/core/alloc.h +++ b/include/rune/core/alloc.h @@ -25,6 +25,9 @@ #include #include +/** + * Memory block used for memory accounting + */ struct mem_block { void *ptr; size_t sz; @@ -32,10 +35,40 @@ struct mem_block { struct list_head list; }; +/** + * \brief Custom malloc implementation + * \param[in] sz The size of the requested memory block + * \return A pointer to void, or NULL in case of error + */ RAPI void* rune_alloc(size_t sz); + +/** + * \brief Custom calloc implementation + * \param[in] nmemb An integer to fill the memory block with + * \param[in] sz The size of the requested memory block + * \return A pointer to void, or NULL in case of error + */ RAPI void* rune_calloc(size_t nmemb, size_t sz); + +/** + * \brief Custom realloc implementation + * \param[in] ptr A void pointer to a previously alloc'd block, or NULL + * \param[in] sz The size of the requested memory block + * \return A pointer to void, or NULL in case of error + */ RAPI void* rune_realloc(void *ptr, size_t sz); + +/** + * \brief Custom free implementation + * \param[in] ptr A void pointer to a previously alloc'd block + */ RAPI void rune_free(void *ptr); + +/** + * \brief Used to free all memory currently in use by the engine + * This function should only be used at the end of execution, and is normally + * called by rune_exit. + */ RAPI void rune_free_all(void); #endif -- cgit v1.2.3