summaryrefslogtreecommitdiff
path: root/bittorrent/epoll_server/utils/xalloc.h
blob: e7655b81e80858acc0a3bc77a9792db7e9f4438d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 */