diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /bittorrent/epoll_server/utils/xalloc.h | |
Diffstat (limited to 'bittorrent/epoll_server/utils/xalloc.h')
| -rw-r--r-- | bittorrent/epoll_server/utils/xalloc.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bittorrent/epoll_server/utils/xalloc.h b/bittorrent/epoll_server/utils/xalloc.h new file mode 100644 index 0000000..e7655b8 --- /dev/null +++ b/bittorrent/epoll_server/utils/xalloc.h @@ -0,0 +1,32 @@ +#ifndef XALLOC_H +#define XALLOC_H + +#include <stddef.h> + +/** +** \brief Malloc wrapper that exits on failure. +** +** \param size The size to malloc. +** \return The malloc return. +*/ +void *xmalloc(size_t size); + +/** +** \brief Calloc wrapper that exits on failure. +** +** \param nmemb The number of elements. +** \param size The size of an element. +** \return The calloc return. +*/ +void *xcalloc(size_t nmemb, size_t size); + +/** +** \brief Realloc wrapper that exits on failure. +** +** \param ptr The mem pointer. +** \param size The size to realloc. +** \return The realloc return. +*/ +void *xrealloc(void *ptr, size_t size); + +#endif /* !XALLOC_H */ |
