diff options
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -79,10 +79,15 @@ static inline bool list_empty(struct list_head *list) &pos->member != (head); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) -static inline void* zmalloc(size_t size) -{ - return calloc(1, size); -} +#define zmalloc(s) ({ fprintf(stderr, "Alloc: zmalloc called from %s: %zu\n", __func__, s); __zmalloc(s); }) +void *__zmalloc(size_t s); + +#define xstrdup(s) ({ fprintf(stderr, "Alloc: xstrdup called from %s: %zu\n", __func__, strlen(s) + 1); __xstrdup(s); }) +char *__xstrdup(const char *s); + +void xfree(void *ptr); + +void debug_resource_usage(); #define ADDRSTRLEN (9 /*strlen("AF_INETX ")*/ + INET6_ADDRSTRLEN + 6 /*strlen(" 65535")*/ + 1) struct sockaddr_in46 { |