mediastreamer2  2.12.1
Functions
Ms_list

Functions

MSList * ms_list_append (MSList *list, void *data)
 
MSList * ms_list_append_link (MSList *list, MSList *new_elem)
 
MSList * ms_list_prepend (MSList *list, void *data)
 
MSList * ms_list_free (MSList *list)
 
MSList * ms_list_free_with_data (MSList *list, void(*freefunc)(void *))
 
MSList * ms_list_concat (MSList *first, MSList *second)
 
MSList * ms_list_remove (MSList *list, void *data)
 
MSList * ms_list_remove_custom (MSList *list, MSCompareFunc compare_func, const void *user_data)
 
int ms_list_size (const MSList *list)
 
void ms_list_for_each (const MSList *list, MSIterateFunc iterate_func)
 
void ms_list_for_each2 (const MSList *list, MSIterate2Func iterate_func, void *user_data)
 
MSList * ms_list_remove_link (MSList *list, MSList *elem)
 
MSList * ms_list_find (MSList *list, void *data)
 
MSList * ms_list_find_custom (MSList *list, MSCompareFunc compare_func, const void *user_data)
 
void * ms_list_nth_data (const MSList *list, int index)
 
int ms_list_position (const MSList *list, MSList *elem)
 
int ms_list_index (const MSList *list, void *data)
 
MSList * ms_list_insert_sorted (MSList *list, void *data, MSCompareFunc compare_func)
 
MSList * ms_list_insert (MSList *list, MSList *before, void *data)
 
MSList * ms_list_copy (const MSList *list)
 
MSList * ms_list_copy_with_data (const MSList *list, void *(*copyfunc)(void *))
 

Detailed Description

Function Documentation

MSList* ms_list_append ( MSList *  list,
void *  data 
)

Inserts a new element containing data to the end of a given list

Parameters
listlist where data should be added. If NULL, a new list will be created.
datadata to insert into the list
Returns
first element of the list
MSList* ms_list_append_link ( MSList *  list,
MSList *  new_elem 
)

Inserts given element to the end of a given list

Parameters
listlist where data should be added. If NULL, a new list will be created.
new_elemelement to append
Returns
first element of the list
MSList* ms_list_prepend ( MSList *  list,
void *  data 
)

Inserts a new element containing data to the start of a given list

Parameters
listlist where data should be added. If NULL, a new list will be created.
datadata to insert into the list
Returns
first element of the list - the one which was just created.
MSList* ms_list_free ( MSList *  list)

Frees all elements of a given list Note that data contained in each element will not be freed. If you need to clean them, consider using

Parameters
listobject to free.
Returns
NULL
MSList* ms_list_free_with_data ( MSList *  list,
void(*)(void *)  freefunc 
)

Frees all elements of a given list after having called freefunc on each element

Parameters
listobject to free.
freefuncfunction to invoke on each element data before destroying the element
Returns
NULL
MSList* ms_list_concat ( MSList *  first,
MSList *  second 
)

Concatenates second list to the end of first list

Parameters
firstFirst list
secondSecond list to append at the end of first list.
Returns
first element of the merged list
MSList* ms_list_remove ( MSList *  list,
void *  data 
)

Finds and remove the first element containing the given data. Nothing is done if element is not found.

Parameters
listList in which data must be removed
dataData to remove
Returns
first element of the modified list
MSList* ms_list_remove_custom ( MSList *  list,
MSCompareFunc  compare_func,
const void *  user_data 
)

Finds and remove any elements according to the given predicate function

Parameters
listList in which data must be removed
compare_funcFunction to invoke on each element. If it returns TRUE, the given element will be deleted.
user_dataUser data to pass to compare_func function
Returns
first element of the modified list
int ms_list_size ( const MSList *  list)

Returns size of a given list

Parameters
listList to measure
Returns
Size of list
void ms_list_for_each ( const MSList *  list,
MSIterateFunc  iterate_func 
)

Invoke function on each element of the list

Parameters
listList object
iterate_funcFunction to invoke on each element.
void ms_list_for_each2 ( const MSList *  list,
MSIterate2Func  iterate_func,
void *  user_data 
)

Invoke function on each element of the list

Parameters
listList object
iterate_funcFunction to invoke on each element.
user_dataUser data to pass to iterate_func function.
MSList* ms_list_remove_link ( MSList *  list,
MSList *  elem 
)

Finds and remove given element in list.

Parameters
listList in which element must be removed
elementelement to remove
Returns
first element of the modified list
MSList* ms_list_find ( MSList *  list,
void *  data 
)

Finds first element containing data in the given list.

Parameters
listList in which element must be found
datadata to find
Returns
element containing data, or NULL if not found
MSList* ms_list_find_custom ( MSList *  list,
MSCompareFunc  compare_func,
const void *  user_data 
)

Finds first element according to the given predicate function

Parameters
listList in which element must be found
compare_funcFunction to invoke on each element. If it returns TRUE, the given element will be returned.
user_dataUser data to pass to compare_func function
Returns
Element matching the predicate, or NULL if none is found.
void* ms_list_nth_data ( const MSList *  list,
int  index 
)

Returns the nth element data of the list

Parameters
listList object
indexdata index which must be returned.
Returns
Element at the given index. NULL if index is invalid (negative or greater or equal to ms_list_size).
int ms_list_position ( const MSList *  list,
MSList *  elem 
)

Returns the index of the given element

Parameters
listList object
elemElement to search for.
Returns
Index of the given element. -1 if not found.
int ms_list_index ( const MSList *  list,
void *  data 
)

Returns the index of the first element containing data

Parameters
listList object
dataData to search for.
Returns
Index of the element containing data. -1 if not found.
MSList* ms_list_insert_sorted ( MSList *  list,
void *  data,
MSCompareFunc  compare_func 
)

Inserts a new element containing data at the place given by compare_func

Parameters
listlist where data should be added. If NULL, a new list will be created.
datadata to insert into the list
compare_funcfunction determining where should the new element be placed
Returns
first element of the list.
MSList* ms_list_insert ( MSList *  list,
MSList *  before,
void *  data 
)

Inserts a new element containing data before the given element

Parameters
listlist where data should be added. If NULL, a new list will be created.
beforeelement parent to the one we will insert.
datadata to insert into the list
Returns
first element of the modified list.
MSList* ms_list_copy ( const MSList *  list)

Copies a list in another one, duplicating elements but not data

Parameters
listlist to copy
Returns
Newly created list
MSList* ms_list_copy_with_data ( const MSList *  list,
void *(*)(void *)  copyfunc 
)

Copies a list in another one, duplicating elements according to the given function

Parameters
listlist to copy
copyfuncfunction to invoke on each element which will return the new list data value
Returns
Newly created list