vlc_vector: add helpers for vectors
Add a new API for handling general-purpose vectors, intended to replace ARRAY_*. Like ARRAY_*, it provides macros to handle a dynamic array generic over the type of its items. Contrary to ARRAY_*: - it does not abort on allocation failure (but reports the error); - it uses size_t instead of int to store the capacity and the size; - it checks for overflows on reallocation. For illustration purpose, embedding a vector of input_item_t* in a struct looks like: struct playlist { struct VLC_VECTOR(input_item_t *) items; // ... }; The main features (with names inspired by std::vector from C++ and std::vec::Vec from Rust) are: - void vlc_vector_init(pv) init the vector (use VLC_VECTOR_INITIALIZER for static init) - void vlc_vector_destroy(pv) destroy the vector and release any associated resources - void vlc_vector_clear(pv) remove all items from the vector - vec.size read the size of the vector - vec.data[i] ac...
include/vlc_vector.h
0 → 100644