man: flowtop: Make wording in description for --version consistent
[netsniff-ng.git] / xmalloc.h
blob3285eb324d50dbf71d0d655cfcf47d04c9df706a
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
5 */
7 #ifndef XMALLOC_H
8 #define XMALLOC_H
10 #include <stdlib.h>
12 #include "built_in.h"
13 #include "die.h"
15 extern void *xmalloc(size_t size) __hidden;
16 extern void *xzmalloc(size_t size) __hidden;
17 extern void *xmallocz(size_t size) __hidden;
18 extern void *xmalloc_aligned(size_t size, size_t alignment) __hidden;
19 extern void *xzmalloc_aligned(size_t size, size_t alignment) __hidden;
20 extern void *xmemdupz(const void *data, size_t len) __hidden;
21 extern void *xrealloc(void *ptr, size_t nmemb, size_t size) __hidden;
22 extern void xfree_func(void *ptr) __hidden;
23 extern char *xstrdup(const char *str) __hidden;
24 extern char *xstrndup(const char *str, size_t size) __hidden;
25 extern int xdup(int fd) __hidden;
27 static inline void __xfree(void *ptr)
29 if (unlikely((ptr) == NULL))
30 panic("xfree: NULL pointer given as argument\n");
31 free(ptr);
34 #define xfree(ptr) \
35 do { \
36 __xfree(ptr); \
37 (ptr) = NULL; \
38 } while (0)
40 #endif /* XMALLOC_H */