Documentation.

This commit is contained in:
Neil 2021-03-21 14:50:30 -07:00
parent 822cc4e4ba
commit 23f3bdb722
1 changed files with 7 additions and 6 deletions

View File

@ -47,10 +47,11 @@ static int name##_array_reserve(struct name##_array *const a, \
a->data = data, a->capacity = c0; \
return 1; \
} \
/** Adds at least `buffer` un-initialised and uncounted elements at the back of
`a`. @return A pointer to the start of `buffer` elements, namely
`data + size`. If `a` is idle and `buffer` is zero, a null pointer is
returned, otherwise this indicates an error. @throws[realloc, ERANGE] */ \
/** Makes sure that there are at least `buffer` contiguous, un-initialised,
elements at the back of `a`.
@return A pointer to the start of `buffer` elements, namely `a.data + a.size`.
If `a` is idle and `buffer` is zero, a null pointer is returned, otherwise
null indicates an error and `errno` will be set. @throws[realloc, ERANGE] */ \
static type *name##_array_buffer(struct name##_array *const a, \
const size_t buffer) { \
assert(a); \
@ -59,8 +60,8 @@ static type *name##_array_buffer(struct name##_array *const a, \
if(!name##_array_reserve(a, a->size + buffer)) return 0; \
return a->data ? a->data + a->size : 0; \
} \
/** Emplaces `n` elements on `a`. `n` must be smaller than or equal to the
highest remaining <fn:<name>_array_buffer>. */ \
/** Adds `n` to the size of `a`; `n` must be smaller than or equal to the
highest remaining buffer value set by <fn:<name>_array_buffer>. */ \
static void name##_array_emplace(struct name##_array *const a, \
const size_t n) { \
assert(a && a->capacity >= a->size && n <= a->capacity - a->size); \