diff --git a/common/util.h b/common/util.h index 6e76a71e..f0caaa08 100644 --- a/common/util.h +++ b/common/util.h @@ -28,6 +28,7 @@ #include #include #include +#include /** A list of possible position, not sex related */ typedef enum @@ -60,6 +61,10 @@ typedef struct #define ssizeof(foo) (ssize_t)sizeof(foo) #define countof(foo) (ssizeof(foo) / ssizeof(foo[0])) +#define p_alloca(type, count) \ + ((type *)memset(alloca(sizeof(type) * (count)), \ + 0, sizeof(type) * (count))) + #define p_alloc_nr(x) (((x) + 16) * 3 / 2) #define p_new(type, count) ((type *)xmalloc(sizeof(type) * (count))) #define p_clear(p, count) ((void)memset((p), 0, sizeof(*(p)) * (count)))