Skip to content

Commit

Permalink
Include stdlib.h instead of alloca.h for alloca(3) on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 authored and Webster Sheets committed Apr 27, 2024
1 parent d4ce2a4 commit ff98b64
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ char (&COUNTOF_Helper(T (&array)[N]))[N];
#include <malloc.h>
#define stackalloc(T, n) reinterpret_cast<T *>(_alloca(sizeof(T) * n))
#else
#ifdef __FreeBSD__
#include <stdlib.h>
#else
#include <alloca.h>
#endif
#define stackalloc(T, n) reinterpret_cast<T *>(alloca(sizeof(T) * n))
#endif

0 comments on commit ff98b64

Please sign in to comment.