VLC 4.0.0-dev
|
This file defines functions, structures and macros for handling arrays in vlc. More...
Go to the source code of this file.
Data Structures | |
struct | vlc_array_t |
struct | vlc_dictionary_entry_t |
struct | vlc_dictionary_t |
Macros | |
#define | TAB_INIT(count, tab) |
#define | TAB_CLEAN(count, tab) |
#define | TAB_APPEND_CAST(cast, count, tab, p) |
#define | TAB_APPEND(count, tab, p) TAB_APPEND_CAST( , count, tab, p ) |
#define | TAB_FIND(count, tab, p, idx) |
#define | TAB_ERASE(count, tab, index) |
#define | TAB_REMOVE(count, tab, p) |
#define | TAB_INSERT_CAST(cast, count, tab, p, index) |
#define | TAB_INSERT(count, tab, p, index) TAB_INSERT_CAST( , count, tab, p, index ) |
#define | BSEARCH(entries, count, elem, zetype, key, answer) |
Binary search in a sorted array. More... | |
#define | _ARRAY_ALLOC(array, newsize) |
#define | _ARRAY_GROW1(array) |
#define | DECL_ARRAY(type) |
#define | TYPEDEF_ARRAY(type, name) typedef DECL_ARRAY(type) name; |
#define | ARRAY_INIT(array) |
#define | ARRAY_RESET(array) |
#define | ARRAY_APPEND(array, elem) |
#define | ARRAY_INSERT(array, elem, pos) |
#define | _ARRAY_SHRINK(array) |
#define | ARRAY_FIND(array, p, idx) TAB_FIND((array).i_size, (array).p_elems, p, idx) |
#define | ARRAY_REMOVE(array, pos) |
#define | ARRAY_VAL(array, pos) array.p_elems[pos] |
#define | ARRAY_BSEARCH(array, elem, zetype, key, answer) BSEARCH( (array).p_elems, (array).i_size, elem, zetype, key, answer) |
#define | ARRAY_FOREACH(item, array) |
#define | vlc_array_item_at_index(ar, idx) |
Typedefs | |
typedef struct vlc_array_t | vlc_array_t |
typedef struct vlc_dictionary_entry_t | vlc_dictionary_entry_t |
typedef struct vlc_dictionary_t | vlc_dictionary_t |
Functions | |
static void * | realloc_down (void *ptr, size_t size) |
static void * | realloc_or_free (void *p, size_t sz) |
This wrapper around realloc() will free the input pointer when realloc() returns NULL. More... | |
static void | vlc_array_init (vlc_array_t *p_array) |
static void | vlc_array_clear (vlc_array_t *p_array) |
static size_t | vlc_array_count (vlc_array_t *p_array) |
static ssize_t | vlc_array_index_of_item (const vlc_array_t *ar, const void *elem) |
static int | vlc_array_insert (vlc_array_t *ar, void *elem, int idx) |
static void | vlc_array_insert_or_abort (vlc_array_t *ar, void *elem, int idx) |
static int | vlc_array_append (vlc_array_t *ar, void *elem) |
static void | vlc_array_append_or_abort (vlc_array_t *ar, void *elem) |
static void | vlc_array_remove (vlc_array_t *ar, size_t idx) |
static uint64_t | DictHash (const char *psz_string, int hashsize) |
static void | vlc_dictionary_init (vlc_dictionary_t *p_dict, int i_size) |
static void | vlc_dictionary_clear (vlc_dictionary_t *p_dict, void(*pf_free)(void *p_data, void *p_obj), void *p_obj) |
static int | vlc_dictionary_has_key (const vlc_dictionary_t *p_dict, const char *psz_key) |
static void * | vlc_dictionary_value_for_key (const vlc_dictionary_t *p_dict, const char *psz_key) |
static int | vlc_dictionary_keys_count (const vlc_dictionary_t *p_dict) |
static bool | vlc_dictionary_is_empty (const vlc_dictionary_t *p_dict) |
static char ** | vlc_dictionary_all_keys (const vlc_dictionary_t *p_dict) |
static void | vlc_dictionary_insert_impl_ (vlc_dictionary_t *p_dict, const char *psz_key, void *p_value, bool rebuild) |
static void | vlc_dictionary_insert (vlc_dictionary_t *p_dict, const char *psz_key, void *p_value) |
static void | vlc_dictionary_remove_value_for_key (const vlc_dictionary_t *p_dict, const char *psz_key, void(*pf_free)(void *p_data, void *p_obj), void *p_obj) |
Variables | |
static void *const | kVLCDictionaryNotFound = NULL |
This file defines functions, structures and macros for handling arrays in vlc.
#define _ARRAY_ALLOC | ( | array, | |
newsize | |||
) |
#define _ARRAY_GROW1 | ( | array | ) |
#define _ARRAY_SHRINK | ( | array | ) |
#define ARRAY_APPEND | ( | array, | |
elem | |||
) |
#define ARRAY_BSEARCH | ( | array, | |
elem, | |||
zetype, | |||
key, | |||
answer | |||
) | BSEARCH( (array).p_elems, (array).i_size, elem, zetype, key, answer) |
#define ARRAY_FOREACH | ( | item, | |
array | |||
) |
#define ARRAY_INIT | ( | array | ) |
#define ARRAY_INSERT | ( | array, | |
elem, | |||
pos | |||
) |
#define ARRAY_REMOVE | ( | array, | |
pos | |||
) |
#define ARRAY_RESET | ( | array | ) |
#define ARRAY_VAL | ( | array, | |
pos | |||
) | array.p_elems[pos] |
#define BSEARCH | ( | entries, | |
count, | |||
elem, | |||
zetype, | |||
key, | |||
answer | |||
) |
Binary search in a sorted array.
The key must be comparable by < and >
entries | array of entries |
count | number of entries |
elem | key to check within an entry (like .id, or ->i_id) |
zetype | type of the key |
key | value of the key |
answer | index of answer within the array. -1 if not found |
#define DECL_ARRAY | ( | type | ) |
#define TAB_APPEND | ( | count, | |
tab, | |||
p | |||
) | TAB_APPEND_CAST( , count, tab, p ) |
#define TAB_CLEAN | ( | count, | |
tab | |||
) |
#define TAB_ERASE | ( | count, | |
tab, | |||
index | |||
) |
#define TAB_INSERT | ( | count, | |
tab, | |||
p, | |||
index | |||
) | TAB_INSERT_CAST( , count, tab, p, index ) |
#define TYPEDEF_ARRAY | ( | type, | |
name | |||
) | typedef DECL_ARRAY(type) name; |
#define vlc_array_item_at_index | ( | ar, | |
idx | |||
) |
typedef struct vlc_array_t vlc_array_t |
typedef struct vlc_dictionary_entry_t vlc_dictionary_entry_t |
typedef struct vlc_dictionary_t vlc_dictionary_t |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
This wrapper around realloc() will free the input pointer when realloc() returns NULL.
The use case ptr = realloc(ptr, newsize) will cause a memory leak when ptr pointed to a heap allocation before, leaving the buffer allocated but unreferenced. vlc_realloc() is a drop-in replacement for that use case (and only that use case).
References p.
Referenced by vlc_config_create().
|
inlinestatic |
References vlc_array_t::i_count, vlc_array_t::pp_elems, and unlikely.
Referenced by dialog_add_locked(), mrl_FragmentSplit(), vlc_array_append_or_abort(), and vlc_http_cookies_store().
|
inlinestatic |
References vlc_array_append().
Referenced by ChangeFilters(), and sout_StreamChainNew().
|
inlinestatic |
References vlc_array_t::pp_elems, and vlc_array_init().
Referenced by ChangeFilters(), mrl_FragmentSplit(), sout_StreamChainNew(), stream_extractor_AttachParsed(), and vlc_http_cookies_destroy().
|
inlinestatic |
|
inlinestatic |
References vlc_array_t::i_count, and vlc_array_t::pp_elems.
Referenced by dialog_remove_locked().
|
inlinestatic |
References vlc_array_t::i_count, and vlc_array_t::pp_elems.
Referenced by ChangeFilters(), fingerprint_request_New(), libvlc_InternalDialogInit(), mrl_FragmentSplit(), sout_StreamChainNew(), vlc_array_clear(), and vlc_http_cookies_new().
|
inlinestatic |
References vlc_array_t::i_count, vlc_array_t::pp_elems, and unlikely.
Referenced by vlc_array_insert_or_abort().
|
inlinestatic |
References vlc_array_insert().
|
inlinestatic |
References vlc_array_t::i_count, likely, and vlc_array_t::pp_elems.
Referenced by dialog_remove_locked(), and vlc_http_cookies_store().
|
inlinestatic |
References count, vlc_dictionary_t::i_size, vlc_dictionary_t::p_entries, vlc_dictionary_entry_t::p_next, vlc_dictionary_entry_t::psz_key, strdup(), unlikely, and vlc_dictionary_keys_count().
Referenced by vlc_meta_CopyExtraNames(), and vlc_meta_Merge().
|
inlinestatic |
|
inlinestatic |
References DictHash(), vlc_dictionary_t::i_size, vlc_dictionary_t::p_entries, vlc_dictionary_entry_t::p_next, and vlc_dictionary_entry_t::psz_key.
Referenced by AddAlbumCache().
|
inlinestatic |
References vlc_dictionary_t::i_size, and vlc_dictionary_t::p_entries.
Referenced by input_fetcher_New(), vlc_dictionary_insert_impl_(), and vlc_meta_New().
|
inlinestatic |
References vlc_dictionary_insert_impl_().
Referenced by AddAlbumCache(), vlc_meta_AddExtra(), and vlc_meta_Merge().
|
inlinestatic |
References count, DictHash(), vlc_dictionary_t::i_size, vlc_dictionary_t::p_entries, vlc_dictionary_entry_t::p_next, vlc_dictionary_entry_t::p_value, vlc_dictionary_entry_t::psz_key, strdup(), vlc_dictionary_clear(), vlc_dictionary_init(), and vlc_dictionary_insert_impl_().
Referenced by vlc_dictionary_insert(), and vlc_dictionary_insert_impl_().
|
inlinestatic |
References vlc_dictionary_t::i_size, and vlc_dictionary_t::p_entries.
|
inlinestatic |
References count, vlc_dictionary_t::i_size, vlc_dictionary_t::p_entries, and vlc_dictionary_entry_t::p_next.
Referenced by vlc_dictionary_all_keys(), and vlc_meta_GetExtraCount().
|
inlinestatic |
References DictHash(), vlc_dictionary_t::i_size, vlc_dictionary_t::p_entries, vlc_dictionary_entry_t::p_next, vlc_dictionary_entry_t::p_value, and vlc_dictionary_entry_t::psz_key.
Referenced by vlc_meta_AddExtra(), and vlc_meta_Merge().
|
inlinestatic |
|
static |
Referenced by vlc_dictionary_value_for_key(), and vlc_meta_AddExtra().