// vim: set noet ts=4 sw=4: /*! \file * \brief C-style dynamic memory allocation interface */ #pragma once #include "../types.h" /*! \brief Allocate a memory block * The memory is not initialized. * * \param size Requested size of memory in bytes. * \return Pointer to memory or `nullptr` on error (no memory available) or if * size was zero. * \opt Implement method */ extern "C" void *malloc(size_t size); /*! \brief Free an allocated memory block * * \param ptr Pointer to an previously allocated memory block. * \opt Implement method */ extern "C" void free(void *ptr); /*! \brief Allocate memory for an array of elements * The memory is set to zero. * * \param nmemb Number of elements * \param size Size of an element in bytes * \return pointer to the allocated memory or `nullptr` if the request fails * \opt Implement method */ extern "C" void *calloc(size_t nmemb, size_t size);