diff options
author | Danny Holman <dholman@gymli.org> | 2024-10-25 23:02:31 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-10-25 23:02:31 -0500 |
commit | 6e8177dae93f592b1d39cd6d6e77c9e6f254360f (patch) | |
tree | 2735f467cec1ae73b9382ac057f817fae1f94dac /include/rune/core/alloc.h | |
parent | 71befd8eaf7244badb0188b751066afacb8d8ee3 (diff) |
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 <dholman@gymli.org>
Diffstat (limited to 'include/rune/core/alloc.h')
-rw-r--r-- | include/rune/core/alloc.h | 33 |
1 files changed, 33 insertions, 0 deletions
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 <rune/util/types.h> #include <rune/util/list.h> +/** + * 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 |