From 49e0e14d7cb48c1e9d882180858dd536efafd013 Mon Sep 17 00:00:00 2001 From: seajee Date: Thu, 24 Jul 2025 13:03:02 +0200 Subject: [PATCH] Support C++ malloc pointer cast --- arena.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arena.h b/arena.h index 3ba12cf..ed551cf 100644 --- a/arena.h +++ b/arena.h @@ -41,7 +41,7 @@ void *arena_alloc(Arena *a, size_t bytes) // Empty arena if (a->head == NULL) { size_t size = (bytes > ARENA_MIN_CAPACITY ? bytes : ARENA_MIN_CAPACITY); - a->head = malloc(sizeof(*a->head) + size); + a->head = (Arena_Region*)malloc(sizeof(*a->head) + size); if (a->head == NULL) { return NULL; } @@ -66,7 +66,7 @@ void *arena_alloc(Arena *a, size_t bytes) } // If not create a new region - a->tail->next = malloc(sizeof(*a->tail) + bytes); + a->tail->next = (Arena_Region*)malloc(sizeof(*a->tail) + bytes); if (a->tail->next == NULL) { return NULL; }