FreeRDP
list.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <freerdp/utils/list.h>

Functions

static LIST_ITEM * list_item_new (void *data)
static LIST_ITEM * list_item_find (LIST *list, void *data)
LIST * list_new (void)
void list_free (LIST *list)
void list_enqueue (LIST *list, void *data)
voidlist_dequeue (LIST *list)
voidlist_peek (LIST *list)
voidlist_next (LIST *list, void *data)
voidlist_remove (LIST *list, void *data)
int list_size (LIST *list)

Function Documentation

void* list_dequeue ( LIST *  list)

Removes the first element of a list, and returns a pointer to it. The list-specific resources associated to this element are freed in the process.

Parameters:
list- pointer to a valid LIST structure
Returns:
a pointer to the data of the first element of this list. NULL if the list is empty.

Here is the caller graph for this function:

void list_enqueue ( LIST *  list,
void data 
)

Add an element at the end of an existing list.

Parameters:
list- pointer to the LIST that will contain the new element
data- pointer to the buffer that will be added to the list

Here is the call graph for this function:

Here is the caller graph for this function:

void list_free ( LIST *  list)

Deallocates a LIST structure. All elements of the list will be removed (but not deallocated). Only the list-specific resources are freed.

Parameters:
list- pointer to the LIST that must be deallocated.

Here is the call graph for this function:

Here is the caller graph for this function:

static LIST_ITEM* list_item_find ( LIST *  list,
void data 
) [static]

Searches an element in the list. The element is verified by its pointer value - there is no way to verify the buffer's content.

Parameters:
list- pointer to a valid LIST structure
data- pointer to the data that must be found.
Returns:
the LIST_ITEM element that contains the 'data' pointer. NULL if 'data' was not found.

Here is the caller graph for this function:

static LIST_ITEM* list_item_new ( void data) [static]

Allocates a new LIST_ITEM element. This will be used to store the data provided by the caller, and will be used as a new element in a list.

Parameters:
data- pointer to the data that must be stored by the new item.
Returns:
An allocated LIST_ITEM element that contains the 'data' pointer.

Here is the caller graph for this function:

LIST* list_new ( void  )

Allocates a new LIST structure. The list_*() API implements a chainlist and allows to store data of arbitrary type in FIFO mode.

See also:
list_enqueue() to add elements to the list.
list_dequeue() to remove the first element of the list and get a pointer to it.
list_peek() to retrieve the first element of the list (and keep it there).
list_free() to deallocate the list.
list_size() to get the current number of elements in the list.
Returns:
A pointer to the allocated LIST structure. It must be deallocated by a call to list_free().

Here is the caller graph for this function:

void* list_next ( LIST *  list,
void data 
)

Searches for the data provided in parameter, and returns a pointer to the element next to it. If the item is not found, or if it is the last in the list, the function will return NULL.

Parameters:
list- pointer to the list that must be searched.
data- pointer to the buffer that must be found. The comparison is done on the pointer value - not the buffer's content.
Returns:
a pointer to the data of the element that resides after the 'data' parameter in the list. NULL if 'data' was not found in the list, or if it is the last element.
See also:
list_item_find() for more information on list item searches.

Here is the call graph for this function:

void* list_peek ( LIST *  list)

Returns a pointer to the data from the first element of the list. The element itself is not removed from the list by this call.

Parameters:
list- pointerto a valid LIST structure
Returns:
a pointer to the data of the first element of this list. NULL if the list is empty.
void* list_remove ( LIST *  list,
void data 
)

Searches for the data provided in parameter, and removes it from the list if it is found.

Parameters:
list- pointer to the list that must be searched.
data- pointer to the buffer that must be found. The comparison is done on the pointer value - not the buffer's content.
Returns:
the 'data' pointer, if the element was found, and successfully removed from the list. NULL if the element was not found.

Here is the call graph for this function:

Here is the caller graph for this function:

int list_size ( LIST *  list)

Returns the current size of the list (number of elements). This number is kept up to date by the list_enqueue and list_dequeue functions.

Parameters:
list- pointer to a valide LIST structure.
Returns:
the number of elements in that list.

Here is the caller graph for this function:

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines