aab739dd4dcf49686de3b94a1fafd73b65ebbe75
3 * @brief Safe memory management.
6 #ifndef CGDS_SAFE_ALLOC_H
7 #define CGDS_SAFE_ALLOC_H
13 * @brief Wrapper around stdlib malloc function.
14 * @return A pointer to the newly allocated area; exit program if fail.
17 size_t size
///< Size of the block to allocate, in bytes.
21 * @brief Wrapper around stdlib calloc function.
22 * @return A pointer to the newly allocated area; exit program if fail.
25 size_t count
, ///< Number of elements to allocate.
26 size_t size
///< Size of the element to allocate, in bytes.
30 * @brief Wrapper around stdlib realloc function.
31 * @return A pointer to the newly allocated area; exit program if fail.
34 void* ptr
, ///< Pointer on the area to be relocated.
35 size_t size
///< Size of the block to reallocate, in bytes.
39 * @brief Wrapper around stdlib free function.
42 void* ptr
///< Pointer on the area to be destroyed.