VLC 4.0.0-dev

This provides convenience helpers for vectors. More...

Include dependency graph for vlc_vector.h:

Go to the source code of this file.

Macros

#define VLC_VECTOR(type)
 Vector struct body. More...
 
#define VLC_VECTOR_INITIALIZER   { 0, 0, NULL }
 Static initializer for a vector. More...
 
#define vlc_vector_init(pv)
 Initialize an empty vector. More...
 
#define vlc_vector_destroy(pv)    free((pv)->data)
 Destroy a vector. More...
 
#define vlc_vector_clear(pv)
 Clear a vector. More...
 
#define VLC_VECTOR_MINCAP_   ((size_t) 10)
 The minimal allocation size, in number of items. More...
 
#define VLC_VECTOR_FAILFLAG_   (~(((size_t) -1) >> 1)) /* only the MSB */
 
#define vlc_vector_realloc_(pv, newcap)
 Realloc the underlying array to newcap. More...
 
#define vlc_vector_resize_(pv, newcap)
 Resize the vector to newcap exactly. More...
 
#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. More...
 
#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. More...
 
#define vlc_vector_autoshrink(pv)
 Resize the vector down automatically. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#define vlc_vector_insert_hole_internal_(pv, index, count)
 
#define vlc_vector_insert(pv, index, item)
 Insert an item at the given index. More...
 
#define vlc_vector_insert_all(pv, index, items, count)
 Insert count items at the given index. More...
 
#define vlc_vector_move_slice(pv, index, count, target)
 Move a slice of items to a given target index. More...
 
#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. More...
 
#define vlc_vector_remove_slice_noshrink(pv, index, count)
 Remove a slice of items, without shrinking the array. More...
 
#define vlc_vector_remove_slice_noshrink_internal_(pv, index, count)
 
#define vlc_vector_remove_slice(pv, index, count)
 Remove a slice of items. More...
 
#define vlc_vector_remove_noshrink(pv, index)    vlc_vector_remove_slice_noshrink(pv, index, 1)
 Remove an item, without shrinking the array. More...
 
#define vlc_vector_remove(pv, index)
 Remove an item. More...
 
#define vlc_vector_swap_remove(pv, index)
 Remove an item. More...
 
#define vlc_vector_index_of(pv, item, pidx)
 Return the index of an item. More...
 
#define vlc_vector_foreach(item, pv)
 For-each loop. More...
 

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. More...
 
static bool vlc_vector_test_and_reset_failflag_ (size_t *pcap)
 Test and reset the fail flag. More...
 
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. More...
 
static void vlc_vector_rotate_array_left_ (char *array, size_t len, size_t distance)
 Right-rotate a (char) array in place. More...
 
static void vlc_vector_rotate_array_right_ (char *array, size_t len, size_t distance)
 Right-rotate a (char) array in place. More...
 
static void vlc_vector_move_ (char *array, size_t index, size_t count, size_t target)
 Move items in a (char) array in place. More...
 

Detailed Description

This provides convenience helpers for vectors.