VLC
4.0.0-dev
|
![]() |
Files | |
file | vlc_list.h |
This provides convenience helpers for linked lists. | |
Data Structures | |
struct | vlc_list |
Doubly-linked list node. More... | |
struct | vlc_list_it |
List iterator. More... | |
Macros | |
#define | VLC_LIST_INITIALIZER(h) { h, h } |
Static initializer for a list head. More... | |
#define | vlc_list_entry_aligned_size(p) ((sizeof (*(p)) + sizeof (max_align_t) - 1) / sizeof (max_align_t)) |
#define | vlc_list_entry_dummy(p) (0 ? (p) : ((void *)(&(max_align_t[vlc_list_entry_aligned_size(p)]){}))) |
#define | vlc_list_offset_p(p, member) ((p) = vlc_list_entry_dummy(p), (char *)(&(p)->member) - (char *)(p)) |
#define | vlc_list_entry_p(node, p, member) (0 ? (p) : (void *)(((char *)(node)) - vlc_list_offset_p(p, member))) |
#define | vlc_list_foreach(pos, head, member) |
List iteration macro. More... | |
#define | vlc_list_entry(ptr, type, member) container_of(ptr, type, member) |
Converts a list node pointer to an element pointer. More... | |
#define | vlc_list_first_entry_or_null(head, type, member) ((type *)vlc_list_first_or_null(head, offsetof (type, member))) |
Gets the first element. More... | |
#define | vlc_list_last_entry_or_null(head, type, member) ((type *)vlc_list_last_or_null(head, offsetof (type, member))) |
Gets the last element. More... | |
#define | vlc_list_prev_entry_or_null(head, entry, type, member) |
#define | vlc_list_next_entry_or_null(head, entry, type, member) |
Functions | |
static void | vlc_list_init (struct vlc_list *restrict head) |
Initializes an empty list head. More... | |
static void | vlc_list_add_between (struct vlc_list *restrict node, struct vlc_list *prev, struct vlc_list *next) |
Inserts an element in a list. More... | |
static void | vlc_list_add_after (struct vlc_list *restrict node, struct vlc_list *prev) |
Inserts an element after another. More... | |
static void | vlc_list_add_before (struct vlc_list *restrict node, struct vlc_list *next) |
Inserts an element before another. More... | |
static void | vlc_list_append (struct vlc_list *restrict node, struct vlc_list *head) |
Appends an element into a list. More... | |
static void | vlc_list_prepend (struct vlc_list *restrict node, struct vlc_list *head) |
Prepends an element into a list. More... | |
static void | vlc_list_remove (struct vlc_list *restrict node) |
Removes an element from a list. More... | |
static void | vlc_list_replace (const struct vlc_list *original, struct vlc_list *restrict substitute) |
Replaces an element with another one. More... | |
static bool | vlc_list_is_empty (const struct vlc_list *head) |
Checks if a list is empty. More... | |
static bool | vlc_list_is_first (const struct vlc_list *node, const struct vlc_list *head) |
Checks if an element is first in a list. More... | |
static bool | vlc_list_is_last (const struct vlc_list *node, const struct vlc_list *head) |
Checks if an element is last in a list. More... | |
static struct vlc_list_it | vlc_list_it_start (const struct vlc_list *head) |
static bool | vlc_list_it_continue (const struct vlc_list_it *restrict it) |
static void | vlc_list_it_next (struct vlc_list_it *restrict it) |
static void * | vlc_list_first_or_null (const struct vlc_list *head, size_t offset) |
static void * | vlc_list_last_or_null (const struct vlc_list *head, size_t offset) |
static void * | vlc_list_prev_or_null (const struct vlc_list *head, struct vlc_list *node, size_t offset) |
static void * | vlc_list_next_or_null (const struct vlc_list *head, struct vlc_list *node, size_t offset) |
#define vlc_list_entry | ( | ptr, | |
type, | |||
member | |||
) | container_of(ptr, type, member) |
Converts a list node pointer to an element pointer.
ptr | list node pointer |
type | list data element type name |
member | list node member within the data element compound type |
#define vlc_list_entry_aligned_size | ( | p | ) | ((sizeof (*(p)) + sizeof (max_align_t) - 1) / sizeof (max_align_t)) |
#define vlc_list_entry_dummy | ( | p | ) | (0 ? (p) : ((void *)(&(max_align_t[vlc_list_entry_aligned_size(p)]){}))) |
#define vlc_list_entry_p | ( | node, | |
p, | |||
member | |||
) | (0 ? (p) : (void *)(((char *)(node)) - vlc_list_offset_p(p, member))) |
#define vlc_list_first_entry_or_null | ( | head, | |
type, | |||
member | |||
) | ((type *)vlc_list_first_or_null(head, offsetof (type, member))) |
Gets the first element.
head | Head of list whose last element to get [IN]. |
Referenced by info_category_Delete(), and QueueTake().
#define vlc_list_foreach | ( | pos, | |
head, | |||
member | |||
) |
List iteration macro.
This macro iterates over all elements (excluding the head) of a list, in order from the first to the last.
For each iteration, it sets the cursor variable to the current element.
pos | Cursor pointer variable identifier. |
head | Head pointer of the list to iterate [IN]. |
member | Identifier of the member of the data type serving as list node. |
Referenced by background_worker_RequestProbe(), BackgroundWorkerCancelLocked(), EsOutChangePosition(), EsOutProgramChangePause(), EsOutProgramDel(), EsOutProgramFind(), EsOutProgramsChangeRate(), EsOutProgramUpdateScrambled(), EsOutSetRecord(), EsOutTerminate(), EsOutVaControlLocked(), httpd_HostCreate(), httpd_HostDelete(), httpd_UrlDelete(), httpd_UrlNew(), httpdLoop(), QueueRemoveAll(), vlc_list_HasInput(), vlc_media_source_provider_Find(), vlc_media_tree_Delete(), vlc_ml_event_send(), vlc_player_destructor_Thread(), vlc_player_SendSmpteTimerSourceUpdates(), vlc_player_SendTimerSourceUpdates(), and vlc_player_UpdateTimerState().
#define VLC_LIST_INITIALIZER | ( | h | ) | { h, h } |
Static initializer for a list head.
#define vlc_list_last_entry_or_null | ( | head, | |
type, | |||
member | |||
) | ((type *)vlc_list_last_or_null(head, offsetof (type, member))) |
Gets the last element.
head | Head of list whose last element to get [IN]. |
#define vlc_list_next_entry_or_null | ( | head, | |
entry, | |||
type, | |||
member | |||
) |
#define vlc_list_offset_p | ( | p, | |
member | |||
) | ((p) = vlc_list_entry_dummy(p), (char *)(&(p)->member) - (char *)(p)) |
#define vlc_list_prev_entry_or_null | ( | head, | |
entry, | |||
type, | |||
member | |||
) |
|
inlinestatic |
Inserts an element after another.
node | Node pointer of the element to insert [OUT]. |
prev | Node pointer of the previous element. |
References vlc_list::next, and vlc_list_add_between().
Referenced by vlc_list_prepend().
|
inlinestatic |
Inserts an element before another.
node | Node pointer of the element to insert [OUT]. |
prev | Node pointer of the next element. |
References vlc_list::prev, and vlc_list_add_between().
Referenced by vlc_list_append().
|
inlinestatic |
Inserts an element in a list.
node | Node pointer of the element to insert [OUT]. |
prev | Node pointer of the previous element. |
next | Node pointer of the next element. |
References vlc_list::next, and vlc_list::prev.
Referenced by vlc_list_add_after(), vlc_list_add_before(), and vlc_list_replace().
Appends an element into a list.
node | Node pointer of the element to append to the list [OUT]. |
head | Head pointer of the list to append the element to. |
References vlc_list_add_before().
Referenced by EsOutAddSlaveLocked(), EsOutProgramAdd(), httpd_HostCreate(), httpd_UrlNew(), httpdLoop(), info_category_ReplaceInfo(), info_category_VaAddInfo(), QueuePush(), SpawnThread(), vlc_media_source_provider_Add(), vlc_media_tree_AddListener(), vlc_ml_event_register_callback(), vlc_player_AddListener(), vlc_player_AddSmpteTimer(), vlc_player_AddTimer(), vlc_player_aout_AddListener(), vlc_player_destructor_AddInput(), vlc_player_destructor_AddStoppingInput(), vlc_player_vout_AddListener(), and vlc_playlist_AddListener().
|
inlinestatic |
References vlc_list::next, and vlc_list_is_empty().
|
inlinestatic |
Initializes an empty list head.
Referenced by background_worker_Create(), httpd_HostCreate(), info_category_New(), input_EsOutNew(), input_item_MergeInfos(), libvlc_MlCreate(), vlc_media_source_provider_New(), vlc_media_tree_Delete(), vlc_media_tree_New(), vlc_player_InitTimer(), vlc_player_New(), and vlc_playlist_New().
|
inlinestatic |
Checks if a list is empty.
head | Head of the list to be checked [IN]. |
false | The list is not empty. |
true | The list is empty. |
References vlc_list::next.
Referenced by EsOutDelete(), EsOutVaControlLocked(), httpd_HostDelete(), httpdLoop(), libvlc_MlRelease(), QueueTake(), vlc_list_first_or_null(), vlc_list_last_or_null(), vlc_player_Delete(), vlc_player_DestroyTimer(), vlc_player_destructor_IsEmpty(), vlc_player_destructor_Thread(), vlc_player_UpdateTimer(), and vlc_playlist_Delete().
|
inlinestatic |
Checks if an element is first in a list.
node | List node of the element [IN]. |
head | Head of the list to be checked [IN]. |
false | The element is not first (or is in another list). |
true | The element is first. |
References vlc_list::prev.
Referenced by vlc_list_prev_or_null().
|
inlinestatic |
Checks if an element is last in a list.
node | List node of the element [IN]. |
head | Head of the list to be checked [IN]. |
false | The element is not last (or is in another list). |
true | The element is last. |
References vlc_list::next.
Referenced by vlc_list_next_or_null().
|
inlinestatic |
|
inlinestatic |
References vlc_list::next.
|
static |
References vlc_list::next.
|
inlinestatic |
References vlc_list::prev, and vlc_list_is_empty().
|
inlinestatic |
References vlc_list::next, and vlc_list_is_last().
|
inlinestatic |
Prepends an element into a list.
node | Node pointer of the element to prepend to the list [OUT]. |
head | Head pointer of the list to prepend the element to. |
References vlc_list_add_after().
|
inlinestatic |
References vlc_list::prev, and vlc_list_is_first().
|
inlinestatic |
Removes an element from a list.
node | Node of the element to remove from a list. |
References vlc_list::next, and vlc_list::prev.
Referenced by EsOutProgramDel(), EsOutTerminate(), EsTerminate(), httpd_ClientDestroy(), httpd_HostDelete(), httpd_UrlDelete(), info_category_Delete(), info_category_DeleteInfo(), info_category_ReplaceInfo(), QueueRemoveAll(), QueueTake(), RemoveThread(), vlc_media_source_provider_Remove(), vlc_media_tree_RemoveListener(), vlc_ml_event_unregister_callback(), vlc_ml_event_unregister_from_callback(), vlc_player_aout_RemoveListener(), vlc_player_destructor_AddJoinableInput(), vlc_player_destructor_AddStoppingInput(), vlc_player_destructor_Thread(), vlc_player_RemoveListener(), vlc_player_RemoveTimer(), vlc_player_vout_RemoveListener(), and vlc_playlist_RemoveListener().
|
inlinestatic |
Replaces an element with another one.
origin | Node pointer of the element to remove from the list [IN]. |
substitute | Node pointer of the replacement [OUT]. |
References vlc_list::next, vlc_list::prev, and vlc_list_add_between().