FreeRDP
|
#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) |
void * | list_dequeue (LIST *list) |
void * | list_peek (LIST *list) |
void * | list_next (LIST *list, void *data) |
void * | list_remove (LIST *list, void *data) |
int | list_size (LIST *list) |
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.
list | - pointer to a valid LIST structure |
void list_enqueue | ( | LIST * | list, |
void * | data | ||
) |
Add an element at the end of an existing list.
list | - pointer to the LIST that will contain the new element |
data | - pointer to the buffer that will be added to the list |
Deallocates a LIST structure. All elements of the list will be removed (but not deallocated). Only the list-specific resources are freed.
list | - pointer to the LIST that must be deallocated. |
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.
list | - pointer to a valid LIST structure |
data | - pointer to the data that must be found. |
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.
data | - pointer to the data that must be stored by the new item. |
Allocates a new LIST structure. The list_*() API implements a chainlist and allows to store data of arbitrary type in FIFO mode.
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.
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 from the first element of the list. The element itself is not removed from the list by this call.
list | - pointerto a valid LIST structure |
void* list_remove | ( | LIST * | list, |
void * | data | ||
) |
Searches for the data provided in parameter, and removes it from the list if it is found.
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. |
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.
list | - pointer to a valide LIST structure. |