mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
Add DARRAY_INIT from the vulkan branch
Couldn't cherry-pick this one as it was a bigger commit.
This commit is contained in:
parent
2966b035bf
commit
38fc7459e4
1 changed files with 19 additions and 0 deletions
|
@ -88,6 +88,25 @@
|
||||||
ar; \
|
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.
|
/** Clear the array.
|
||||||
|
|
||||||
If the array can grow, its backing will be freed and maxSize and a reset,
|
If the array can grow, its backing will be freed and maxSize and a reset,
|
||||||
|
|
Loading…
Reference in a new issue