![]() |
Flowgrind
Advanced TCP traffic generator
|
Generic doubly linked list implementation. More...
Go to the source code of this file.
Functions | |
| static struct list_node * | create_node (void *const data, struct list_node *const previous, struct list_node *const next) |
| Creates a new list element on the heap. More... | |
| const struct list_node * | fg_list_back (struct linked_list *const list) |
| Returns the last element of the list. More... | |
| int | fg_list_clear (struct linked_list *const list) |
| Removes and destroys all elements from the list, leaving it with a size of 0. More... | |
| const struct list_node * | fg_list_front (struct linked_list *const list) |
| Returns the first element of the list. More... | |
| int | fg_list_init (struct linked_list *const list) |
| Initializes the list by setting its head and tail to NULL and its size to 0. More... | |
| void * | fg_list_pop_back (struct linked_list *const list) |
| Removes the last element in the list, effectively reducing its size by one. More... | |
| void * | fg_list_pop_front (struct linked_list *const list) |
| Removes the first element in the list, effectively reducing its size by one. More... | |
| int | fg_list_push_back (struct linked_list *const list, void *const data) |
| Inserts a new element at the end of the list. More... | |
| int | fg_list_push_front (struct linked_list *const list, void *const data) |
| Inserts a new element at the beginning of the list. More... | |
| int | fg_list_remove (struct linked_list *const list, const void *const data) |
Removes from the list the first element whose data points to data. More... | |
| size_t | fg_list_size (struct linked_list *const list) |
| Returns the number of elements in the list. More... | |
Generic doubly linked list implementation.
Definition in file fg_list.c.
|
static |
Creates a new list element on the heap.
It prepares it for insertion into the list between elements pointed to by previous and next. The data of the newly created element will point to the same memory location as data.
| [in] | data | data of newly created element |
| [in] | previous | existing list element the new element will be inserted after |
| [in] | next | existing list element the new element will be inserted before |
| const struct list_node* fg_list_back | ( | struct linked_list *const | list | ) |
| int fg_list_clear | ( | struct linked_list *const | list | ) |
| const struct list_node* fg_list_front | ( | struct linked_list *const | list | ) |
| int fg_list_init | ( | struct linked_list *const | list | ) |
| void* fg_list_pop_back | ( | struct linked_list *const | list | ) |
Removes the last element in the list, effectively reducing its size by one.
This destroys the removed element. The data contained in this element will not be modified.
| [in] | list | to operate on |
Definition at line 188 of file fg_list.c.
| void* fg_list_pop_front | ( | struct linked_list *const | list | ) |
Removes the first element in the list, effectively reducing its size by one.
This destroys the removed element. The data contained in this element will not be modified.
| [in] | list | to operate on |
Definition at line 144 of file fg_list.c.
| int fg_list_push_back | ( | struct linked_list *const | list, |
| void *const | data | ||
| ) |
Inserts a new element at the end of the list.
The data of the new element will point to the same memory location as data. This effectively increases the list's size by one.
| [in] | list | to operate on |
| [in] | data | of inserted element |
Definition at line 167 of file fg_list.c.
| int fg_list_push_front | ( | struct linked_list *const | list, |
| void *const | data | ||
| ) |
Inserts a new element at the beginning of the list.
The data of the new element will point to the same memory location as data. This effectively increases the list's size by one.
| [in] | list | to operate on |
| [in] | data | of inserted element |
Definition at line 123 of file fg_list.c.
| int fg_list_remove | ( | struct linked_list *const | list, |
| const void *const | data | ||
| ) |
Removes from the list the first element whose data points to data.
It reduces the list size by one. The data contained in this element will not be modified.
| [in] | list | to operate on |
| [in] | data | of the element to be removed |
Definition at line 65 of file fg_list.c.
| size_t fg_list_size | ( | struct linked_list *const | list | ) |