A linked list implementation.
More...
Go to the source code of this file.
|
static void | gp_list_push_head (gp_list *list, gp_list_head *entry) |
| Pushes into head of linked list.
|
|
static void | gp_dlist_push_head (gp_dlist *list, gp_dlist_head *entry) |
| Pushes into head of double linked list.
|
|
static void | gp_list_push_tail (gp_list *list, gp_list_head *entry) |
| Pushes into tail of linked list.
|
|
static void | gp_dlist_push_tail (gp_dlist *list, gp_dlist_head *entry) |
| Pushes into tail of double linked list.
|
|
static void | gp_dlist_push_after (gp_dlist *list, gp_dlist_head *after, gp_dlist_head *entry) |
| Pushes an entry into a double linked list after an entry.
|
|
static void | gp_dlist_push_before (gp_dlist *list, gp_dlist_head *before, gp_dlist_head *entry) |
| Pushes an entry into a double linked list before an entry.
|
|
static gp_list_head * | gp_list_pop_head (gp_list *list) |
| Pops from a head of a linked list.
|
|
static gp_dlist_head * | gp_dlist_pop_head (gp_dlist *list) |
| Pops from a head of a double linked list.
|
|
static gp_dlist_head * | gp_dlist_pop_tail (gp_dlist *list) |
| Pops from a tail of a double linked list.
|
|
static void | gp_dlist_rem (gp_dlist *list, gp_dlist_head *entry) |
| Removes a entry from a double linked list.
|
|
static void | gp_list_sort (gp_list *list, int(*cmp)(const void *, const void *)) |
| Sorts a linked list given a element comparsion function.
|
|
static void | gp_dlist_sort (gp_dlist *list, int(*cmp)(const void *, const void *)) |
| Sorts a double linked list given a compare function.
|
|
A linked list implementation.
Definition in file gp_list.h.
◆ gp_dlist_pop_head()
static gp_dlist_head * gp_dlist_pop_head |
( |
gp_dlist * |
list | ) |
|
|
inlinestatic |
Pops from a head of a double linked list.
The returned pointer has to be converted to a structure by gp_list_entry().
- Parameters
-
list | A double linked list. |
- Returns
- Entry list head or NULL on empty list.
Definition at line 199 of file gp_list.h.
References gp_list_pop_head().
◆ gp_dlist_pop_tail()
static gp_dlist_head * gp_dlist_pop_tail |
( |
gp_dlist * |
list | ) |
|
|
inlinestatic |
Pops from a tail of a double linked list.
The returned pointer has to be converted to a structure by gp_list_entry().
- Parameters
-
list | A double linked list. |
- Returns
- Entry list head or NULL on empty list.
Definition at line 219 of file gp_list.h.
◆ gp_dlist_push_after()
static void gp_dlist_push_after |
( |
gp_dlist * |
list, |
|
|
gp_dlist_head * |
after, |
|
|
gp_dlist_head * |
entry |
|
) |
| |
|
inlinestatic |
Pushes an entry into a double linked list after an entry.
- Parameters
-
list | A double linked list. |
after | The entry to be pushed after. |
entry | An entry to be pushed. |
Definition at line 130 of file gp_list.h.
◆ gp_dlist_push_before()
static void gp_dlist_push_before |
( |
gp_dlist * |
list, |
|
|
gp_dlist_head * |
before, |
|
|
gp_dlist_head * |
entry |
|
) |
| |
|
inlinestatic |
Pushes an entry into a double linked list before an entry.
- Parameters
-
list | A double linked list. |
before | The entry to be pushed before. |
entry | An entry to be pushed. |
Definition at line 152 of file gp_list.h.
◆ gp_dlist_push_head()
static void gp_dlist_push_head |
( |
gp_dlist * |
list, |
|
|
gp_dlist_head * |
entry |
|
) |
| |
|
inlinestatic |
Pushes into head of double linked list.
- Parameters
-
list | A double linked list. |
entry | An entry to be pushed. |
Definition at line 72 of file gp_list.h.
References gp_list_push_head().
◆ gp_dlist_push_tail()
static void gp_dlist_push_tail |
( |
gp_dlist * |
list, |
|
|
gp_dlist_head * |
entry |
|
) |
| |
|
inlinestatic |
Pushes into tail of double linked list.
- Parameters
-
list | A double linked list. |
entry | An entry to be pushed. |
Definition at line 115 of file gp_list.h.
◆ gp_dlist_rem()
static void gp_dlist_rem |
( |
gp_dlist * |
list, |
|
|
gp_dlist_head * |
entry |
|
) |
| |
|
inlinestatic |
Removes a entry from a double linked list.
The entry must be present in the list!
- Parameters
-
list | A double linked list. |
entry | An entry to remove. |
Definition at line 246 of file gp_list.h.
◆ gp_dlist_sort()
static void gp_dlist_sort |
( |
gp_dlist * |
list, |
|
|
int(*)(const void *, const void *) |
cmp |
|
) |
| |
|
inlinestatic |
Sorts a double linked list given a compare function.
See gp_list_sort() for detailed description.
- Parameters
-
list | A double linked list. |
cmp | A compare function. |
Definition at line 359 of file gp_list.h.
◆ gp_list_pop_head()
static gp_list_head * gp_list_pop_head |
( |
gp_list * |
list | ) |
|
|
inlinestatic |
Pops from a head of a linked list.
The returned pointer has to be converted to a structure by gp_list_entry().
- Parameters
-
- Returns
- Entry list head or NULL on empty list.
Definition at line 175 of file gp_list.h.
Referenced by gp_dlist_pop_head().
◆ gp_list_push_head()
static void gp_list_push_head |
( |
gp_list * |
list, |
|
|
gp_list_head * |
entry |
|
) |
| |
|
inlinestatic |
Pushes into head of linked list.
- Parameters
-
list | A linked list. |
entry | An entry to be pushed. |
Definition at line 55 of file gp_list.h.
Referenced by gp_dlist_push_head().
◆ gp_list_push_tail()
static void gp_list_push_tail |
( |
gp_list * |
list, |
|
|
gp_list_head * |
entry |
|
) |
| |
|
inlinestatic |
Pushes into tail of linked list.
- Parameters
-
list | A linked list. |
entry | An entry to be pushed. |
Definition at line 102 of file gp_list.h.
◆ gp_list_sort()
static void gp_list_sort |
( |
gp_list * |
list, |
|
|
int(*)(const void *, const void *) |
cmp |
|
) |
| |
|
inlinestatic |
Sorts a linked list given a element comparsion function.
The compare function works the same as a in the qsort() system function, however the pointers passed are pointers to list head structure. Use gp_list_entry() macro to get the pointers to the structures instead.
Example compare function would look like:
struct foo {
int i;
gp_list_head head;
};
static int cmp(const void *a, const void *b)
{
struct foo *fa = gp_list_entry(a, struct foo, head);
struct foo *fb = gp_list_entry(b, struct foo, head);
return fa->i - fb->i;
}
- Parameters
-
list | A linked list. |
cmp | A compare function. |
Definition at line 336 of file gp_list.h.