From 0d4aa6cce383e7ca569c047c0eddbda88a15feb0 Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 12 Sep 2022 17:27:42 +0100 Subject: [PATCH] common.h: allow for no alloca.h on BSD --- backend/common.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/common.h b/backend/common.h index 13228ef6..7b70747c 100644 --- a/backend/common.h +++ b/backend/common.h @@ -33,6 +33,10 @@ #ifndef Z_COMMON_H #define Z_COMMON_H +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) ((int) (sizeof(x) / sizeof((x)[0]))) #endif @@ -41,7 +45,9 @@ # include # define z_alloca(nmemb) _alloca(nmemb) #else -# include +# if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)) /* BSD */ +# include +# endif # define z_alloca(nmemb) alloca(nmemb) #endif @@ -149,10 +155,6 @@ typedef unsigned __int64 uint64_t; # define set_module_colour(s, y, x, c) do { (s)->encoded_data[(y)][(x)] = (c); } while (0) #endif -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - INTERNAL int ctoi(const char source); INTERNAL char itoc(const int source); INTERNAL int to_int(const unsigned char source[], const int length);