And add an explicit cast on the pointer returned by malloc() to
make C++ happy.
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>
#define STACK_ARRAY_SIZE 8
#define STACK_ARRAY(type, name, size) \
- type _stack_##name[STACK_ARRAY_SIZE] = {0}, *const name = \
- (size) <= STACK_ARRAY_SIZE ? _stack_##name : malloc((size) * sizeof(type))
+ type _stack_##name[STACK_ARRAY_SIZE] = {0}; \
+ type *const name = \
+ ((size) <= STACK_ARRAY_SIZE ? _stack_##name : (type *)malloc((size) * sizeof(type)))
#define STACK_ARRAY_FINISH(name) \
if (name != _stack_##name) free(name)