orca-software
|
#include <hal.h>
#include <libc.h>
#include <malloc.h>
#include <list.h>
Functions | |
struct list * | hf_list_init (void) |
Initializes a list. More... | |
int32_t | hf_list_append (struct list *lst, void *item) |
Appends a new node to the end of the list. More... | |
int32_t | hf_list_insert (struct list *lst, void *item, int32_t pos) |
Inserts a new node to an arbitrary position in a list. More... | |
int32_t | hf_list_remove (struct list *lst, int32_t pos) |
Removes an arbitrary node from a list. More... | |
void * | hf_list_get (struct list *lst, int32_t pos) |
Returns the address of the data belonging to a list node. More... | |
int32_t | hf_list_set (struct list *lst, void *item, int32_t pos) |
Changes the address of the data belonging to a list node. More... | |
int32_t | hf_list_count (struct list *lst) |
Returns the number of nodes in a list. More... | |
This source code is licensed under the GNU General Public License, Version 2. See the file 'doc/license/gpl-2.0.txt' for more details.
List manipulation primitives and auxiliary functions. List structures are allocated dynamically at runtime, which makes them very flexible. Memory is allocated / deallocated on demand, so additional memory management penalties are incurred.
int32_t hf_list_append | ( | struct list * | lst, |
void * | item | ||
) |
Appends a new node to the end of the list.
lst | is a pointer to a list structure. |
item | is a pointer to data belonging to the list node. |
int32_t hf_list_count | ( | struct list * | lst | ) |
Returns the number of nodes in a list.
lst | is a pointer to a list structure. |
void* hf_list_get | ( | struct list * | lst, |
int32_t | pos | ||
) |
Returns the address of the data belonging to a list node.
lst | is a pointer to a list structure. |
pos | is the n-th element position in the list. |
struct list* hf_list_init | ( | void | ) |
Initializes a list.
int32_t hf_list_insert | ( | struct list * | lst, |
void * | item, | ||
int32_t | pos | ||
) |
Inserts a new node to an arbitrary position in a list.
lst | is a pointer to a list structure. |
item | is a pointer to data belonging to the list node. |
pos | is the n-th element position in the list. |
int32_t hf_list_remove | ( | struct list * | lst, |
int32_t | pos | ||
) |
Removes an arbitrary node from a list.
lst | is a pointer to a list structure. |
pos | is the n-th element position in the list. |
int32_t hf_list_set | ( | struct list * | lst, |
void * | item, | ||
int32_t | pos | ||
) |
Changes the address of the data belonging to a list node.
lst | is a pointer to a list structure. |
item | is an address to data belonging to the list node. |
pos | is the n-th element position in the list. |