A macro-based dynamic array implementation. More...
Go to the source code of this file.
Data Structures | |
struct | vrna_array_header_s |
The header of an array. More... | |
Macros | |
#define | vrna_array(Type) Type * |
Define an array. | |
#define | vrna_array_make(Type, Name) Type * Name; vrna_array_init(Name) |
Make an array Name of type Type . | |
#define | VRNA_ARRAY_GROW_FORMULA(n) (1.4 * (n) + 8) |
The default growth formula for array. | |
#define | VRNA_ARRAY_HEADER(input) ((vrna_array_header_t *)(input) - 1) |
Retrieve a pointer to the header of an array input . | |
#define | vrna_array_size(input) (VRNA_ARRAY_HEADER(input)->num) |
Get the number of elements of an array input . | |
#define | vrna_array_capacity(input) (VRNA_ARRAY_HEADER(input)->size) |
Get the size of an array input , i.e. its actual capacity. | |
#define | vrna_array_set_capacity(a, capacity) |
Explicitely set the capacity of an array a . | |
#define | vrna_array_init_size(a, init_size) |
Initialize an array a with a particular pre-allocated size init_size . | |
#define | vrna_array_init(a) vrna_array_init_size(a, VRNA_ARRAY_GROW_FORMULA(0)); |
Initialize an array a . | |
#define | vrna_array_free(a) |
Release memory of an array a . | |
#define | vrna_array_append(a, item) |
Safely append an item to an array a . | |
#define | vrna_array_grow(a, min_capacity) |
Grow an array a to provide a minimum capacity min_capacity . | |
Typedefs | |
typedef struct vrna_array_header_s | vrna_array_header_t |
The header of an array. | |
Functions | |
VRNA_NO_INLINE void * | vrna__array_set_capacity (void *array, size_t capacity, size_t element_size) |
Explicitely set the capacity of an array. | |
A macro-based dynamic array implementation.
,