Add DARRAY_INIT from the vulkan branch

Couldn't cherry-pick this one as it was a bigger commit.
This commit is contained in:
Bill Currie 2020-03-20 12:52:56 +09:00
parent 2966b035bf
commit 38fc7459e4

View file

@ -88,6 +88,25 @@
ar; \
})
/** Initialized the array.
The array will be initialized to be empty but with grow set to the
specifed value.
\param array *Address* of the array to be modified (ie, pointer to the
array struct instance, not the instance itself: use & for
static instances of the array struct).
\param growSize Number of elements by which the array is to grow when
required.
\hideinitializer
*/
#define DARRAY_INIT(array, growSize) \
do { \
__auto_type ar = (array); \
ar->size = ar->maxSize = 0; \
ar->grow = (growSize); \
} while (0)
/** Clear the array.
If the array can grow, its backing will be freed and maxSize and a reset,