From b66ea1b4cd89c2013762c927b1b7d44263faf05a Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 31 Aug 2021 22:09:56 +0200 Subject: [PATCH] Updating CALLOCS --- src/utils/lib.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/lib.h b/src/utils/lib.h index 2ebe29c6f..44ff6b8e8 100644 --- a/src/utils/lib.h +++ b/src/utils/lib.h @@ -38,8 +38,15 @@ void taskqueue_add(TaskQueueRef queue, Task *task); void taskqueue_destroy(TaskQueueRef queue); void taskqueue_wait_for_completion(TaskQueueRef queue); +static inline void *calloc_arena(size_t size) +{ + void *ptr = malloc_arena(size); + memset(ptr, 0, size); + return ptr; +} + #define MALLOC(mem) malloc_arena(mem) -#define CALLOCS(type) ({ type *__x = malloc_arena(sizeof(type)); memset(__x, 0, sizeof(type)); __x; }) +#define CALLOCS(type) calloc_arena(sizeof(type)) static inline bool is_power_of_two(uint64_t x) {