summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/utils.h b/utils.h
index 81ffdb8..2eeb5d4 100644
--- a/utils.h
+++ b/utils.h
@@ -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 {