VLC 4.0.0-dev
|
This provides convenience helpers for vectors. More...
Go to the source code of this file.
Macros | |
#define | VLC_VECTOR(type) |
Vector struct body. | |
#define | VLC_VECTOR_INITIALIZER { 0, 0, NULL } |
Static initializer for a vector. | |
#define | vlc_vector_init(pv) |
Initialize an empty vector. | |
#define | vlc_vector_destroy(pv) free((pv)->data) |
Destroy a vector. | |
#define | vlc_vector_clear(pv) |
Clear a vector. | |
#define | VLC_VECTOR_MINCAP_ ((size_t) 10) |
The minimal allocation size, in number of items. | |
#define | VLC_VECTOR_FAILFLAG_ (~(((size_t) -1) >> 1)) /* only the MSB */ |
#define | vlc_vector_realloc_(pv, newcap) |
Realloc the underlying array to newcap . | |
#define | vlc_vector_resize_(pv, newcap) |
Resize the vector to newcap exactly. | |
#define | vlc_vector_max_cap_(pv) (SIZE_MAX / 2 / sizeof(*(pv)->data)) |
#define | vlc_vector_reserve(pv, mincap) |
Increase the capacity of the vector to at least mincap . | |
#define | vlc_vector_reserve_internal_(pv, mincap) |
#define | vlc_vector_shrink_to_fit(pv) |
Resize the vector so that its capacity equals its actual size. | |
#define | vlc_vector_autoshrink(pv) |
Resize the vector down automatically. | |
#define | vlc_vector_check_same_ptr_type_(a, b) (void) ((a) == (b)) /* warn on type mismatch */ |
#define | vlc_vector_push(pv, item) |
Push an item at the end of the vector. | |
#define | vlc_vector_push_hole(pv, count) |
Push a hole at the end of the vector. | |
#define | vlc_vector_push_all(pv, items, count) vlc_vector_push_all_internal_(pv, items, vlc_vector_enforce_size_t_(count)) |
Append count items at the end of the vector. | |
#define | vlc_vector_push_all_internal_(pv, items, count) |
#define | vlc_vector_insert_hole(pv, index, count) |
Insert an hole of size count to the given index. | |
#define | vlc_vector_insert_hole_internal_(pv, index, count) |
#define | vlc_vector_insert(pv, index, item) |
Insert an item at the given index. | |
#define | vlc_vector_insert_all(pv, index, items, count) |
Insert count items at the given index. | |
#define | vlc_vector_move_slice(pv, index, count, target) |
Move a slice of items to a given target index. | |
#define | vlc_vector_move_slice_internal_(pv, index, count, target) |
#define | vlc_vector_move(pv, index, target) vlc_vector_move_slice(pv, index, 1, target) |
Move an item to a given target index. | |
#define | vlc_vector_remove_slice_noshrink(pv, index, count) |
Remove a slice of items, without shrinking the array. | |
#define | vlc_vector_remove_slice_noshrink_internal_(pv, index, count) |
#define | vlc_vector_remove_slice(pv, index, count) |
Remove a slice of items. | |
#define | vlc_vector_remove_noshrink(pv, index) vlc_vector_remove_slice_noshrink(pv, index, 1) |
Remove an item, without shrinking the array. | |
#define | vlc_vector_remove(pv, index) |
Remove an item. | |
#define | vlc_vector_swap_remove(pv, index) |
Remove an item. | |
#define | vlc_vector_index_of(pv, item, pidx) |
Return the index of an item. | |
#define | vlc_vector_foreach(item, pv) |
For-each loop. | |
#define | vlc_vector_foreach_ref(ref, pv) |
For-each loop with a reference iterator. | |
#define | vlc_vector_last(pv) |
Returns the vector's last element. | |
#define | vlc_vector_last_ref(pv) |
Returns a reference on the vector's last element. | |
Functions | |
static size_t | vlc_vector_min_ (size_t a, size_t b) |
static size_t | vlc_vector_max_ (size_t a, size_t b) |
static size_t | vlc_vector_between_ (size_t x, size_t min, size_t max) |
static size_t | vlc_vector_enforce_size_t_ (size_t value) |
static void * | vlc_vector_reallocdata_ (void *ptr, size_t count, size_t size, size_t *restrict pcap, size_t *restrict psize) |
Realloc data and update vector fields. | |
static bool | vlc_vector_test_and_reset_failflag_ (size_t *pcap) |
Test and reset the fail flag. | |
static size_t | vlc_vector_growsize_ (size_t value) |
static void | vlc_vector_reverse_array_ (char *array, size_t len) |
Reverse a char array in place. | |
static void | vlc_vector_rotate_array_left_ (char *array, size_t len, size_t distance) |
Right-rotate a (char) array in place. | |
static void | vlc_vector_rotate_array_right_ (char *array, size_t len, size_t distance) |
Right-rotate a (char) array in place. | |
static void | vlc_vector_move_ (char *array, size_t index, size_t count, size_t target) |
Move items in a (char) array in place. | |
This provides convenience helpers for vectors.