From cf9ac98ffde28466b254d2e04f36014b0bcaec50 Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 3 Aug 2023 11:17:04 +0300 Subject: [PATCH] Use realloc because reallocarray doesn't exist for some versions of C ;-; --- src/hu_stuff.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 97ac3c3a0..effb24837 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -438,8 +438,13 @@ static void Chatlogsize_OnChange(void) HU_removeChatText_Log(); } +// Some versons of C don't have reallocarray sadly +#define reallocarray(ptr, nmemb, size) realloc(ptr, (nmemb)*(size)) + // TODO - use z_zone allocators? chat_log = reallocarray(chat_log, cv_chatlogsize.value, sizeof(char*)); + +#undef reallocarray chat_nummsg_log = min(chat_nummsg_log, (UINT32)cv_chatlogsize.value); } #endif