Piojo List implementation.
piojo_list_t* piojo_list_alloc |
( |
void |
| ) |
|
Allocates a new list. Uses default allocator and entry size of int.
- Returns
- New list.
piojo_list_t* piojo_list_alloc_cb |
( |
size_t |
esize, |
|
|
piojo_alloc_if |
allocator |
|
) |
| |
Allocates a new list.
- Parameters
-
[in] | esize | Entry size in bytes. |
[in] | allocator | Allocator to be used. |
- Returns
- New list.
piojo_list_t* piojo_list_alloc_s |
( |
size_t |
esize | ) |
|
Allocates a new list. Uses default allocator.
- Parameters
-
[in] | esize | Entry size in bytes. |
- Returns
- New list.
piojo_list_node_t* piojo_list_append |
( |
const void * |
data, |
|
|
piojo_list_t * |
list |
|
) |
| |
Inserts a new entry at the end of list.
- Parameters
-
[in] | data | Entry value. |
[out] | list | List being modified. |
- Returns
- Node of inserted entry.
void piojo_list_clear |
( |
piojo_list_t * |
list | ) |
|
Deletes all entries in list.
- Parameters
-
[out] | list | List being cleared. |
piojo_list_t* piojo_list_copy |
( |
const piojo_list_t * |
list | ) |
|
Copies list and all its entries.
- Parameters
-
[in] | list | List being copied. |
- Returns
- New list.
piojo_list_node_t* piojo_list_delete |
( |
const piojo_list_node_t * |
node, |
|
|
piojo_list_t * |
list |
|
) |
| |
Deletes a node.
- Parameters
-
[in] | node | Node of the entry being deleted. |
[out] | list | Non-empty list. |
- Returns
- Next node, NULL if list is now empty.
void* piojo_list_entry |
( |
const piojo_list_node_t * |
node | ) |
|
Reads entry from node.
- Parameters
-
- Returns
- Entry value.
piojo_list_node_t* piojo_list_first |
( |
const piojo_list_t * |
list | ) |
|
Reads the first node in list.
- Parameters
-
- Returns
- First node, NULL if list is empty.
void piojo_list_free |
( |
const piojo_list_t * |
list | ) |
|
Frees list and all its entries.
- Parameters
-
[in] | list | List being freed. |
piojo_list_node_t* piojo_list_insert |
( |
const void * |
data, |
|
|
piojo_list_node_t * |
next, |
|
|
piojo_list_t * |
list |
|
) |
| |
Inserts a new entry.
- Parameters
-
[in] | data | Entry value. |
[in] | next | Node following the entry being inserted. |
[out] | list | List being modified. |
- Returns
- Node of inserted entry.
piojo_list_node_t* piojo_list_last |
( |
const piojo_list_t * |
list | ) |
|
Reads the last node in list.
- Parameters
-
- Returns
- Last node, NULL if list is empty.
piojo_list_node_t* piojo_list_next |
( |
const piojo_list_node_t * |
node | ) |
|
Reads the next node.
- Parameters
-
- Returns
- Next node, NULL if node is the last one.
piojo_list_node_t* piojo_list_prepend |
( |
const void * |
data, |
|
|
piojo_list_t * |
list |
|
) |
| |
Inserts a new entry at the beginning of list.
- Parameters
-
[in] | data | Entry value. |
[out] | list | List being modified. |
- Returns
- Node of inserted entry.
piojo_list_node_t* piojo_list_prev |
( |
const piojo_list_node_t * |
node | ) |
|
Reads the previous node.
- Parameters
-
- Returns
- Previous node, NULL if node is the first one.
piojo_list_node_t* piojo_list_set |
( |
const void * |
data, |
|
|
piojo_list_node_t * |
node, |
|
|
piojo_list_t * |
list |
|
) |
| |
Replaces an entry.
- Parameters
-
[in] | data | Entry value. |
[in] | node | Node being replaced. |
[out] | list | List being modified. |
- Returns
- node.
size_t piojo_list_size |
( |
const piojo_list_t * |
list | ) |
|
Returns number of entries.
- Parameters
-
- Returns
- Number of entries in list.
const size_t piojo_list_sizeof |