Updated doc.

This commit is contained in:
Neil 2021-05-30 13:31:06 -07:00
parent 703b066f5a
commit d432704f62
2 changed files with 6 additions and 5 deletions

View File

@ -1,8 +1,8 @@
/** Macro for a type-specific minimal dynamic array: `MIN_ARRAY(name, type)`,
where `name` is an identifier prefix that satisfies `C` naming conventions
when mangled and `type` is defined tag-type associated therewith. When
expanding the array, resizing may be necessary and incurs amortised cost; any
pointers to this memory may become stale. */
/** Macro for a generic minimal dynamic array: `MIN_ARRAY(name, type)`, where
`name` is an identifier prefix that satisfies `C` naming conventions when
mangled and `type` is defined tag-type associated therewith. When expanding
the array, resizing may be necessary and incurs amortised cost; any pointers
to this memory may become stale. */
#include <stdlib.h> /* size_t realloc free */
#include <string.h> /* memmove strcmp memcpy */
@ -29,6 +29,7 @@ static int name##_array_reserve(struct name##_array *const a, \
const size_t max_size = (size_t)-1 / sizeof *a->data; \
assert(a); \
if(a->data) { \
assert(a->size <= a->capacity); \
if(min_capacity <= a->capacity) return 1; \
c0 = a->capacity; \
} else { /* Idle. */ \