buffer and emplace added to ignored.
This commit is contained in:
parent
be5f61fad3
commit
703b066f5a
@ -60,20 +60,21 @@ 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; \
|
||||
} \
|
||||
/** 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>. */ \
|
||||
/** Adds `n` to the size of `a`; this must be no more than the maximum
|
||||
remaining buffer capacity, 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); \
|
||||
a->size += n; \
|
||||
} \
|
||||
/** @return Push back a new un-initialized datum of `a`.
|
||||
@throws[realloc, ERANGE] */ \
|
||||
@throws[realloc, ERANGE] */ \
|
||||
static type *name##_array_new(struct name##_array *const a) { \
|
||||
type *const data = name##_array_buffer(a, 1); \
|
||||
return data ? name##_array_emplace(a, 1), data : 0; \
|
||||
} \
|
||||
/* It's perfectly valid that these functions are not used. */ \
|
||||
static void name##_unused_coda(void); static void name##_unused(void) { \
|
||||
name##_array(0); name##_array_new(0); name##_unused_coda(); } \
|
||||
name##_array(0); name##_array_buffer(0, 0); name##_array_emplace(0, 0); \
|
||||
name##_array_new(0); name##_unused_coda(); } \
|
||||
static void name##_unused_coda(void) { name##_unused(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user