orca-software
list.h
1 #ifndef _LIST_H
2 #define _LIST_H
3 
7 struct list {
8  void *elem;
9  struct list *next;
10 };
11 
12 struct list *hf_list_init(void);
13 int32_t hf_list_append(struct list *lst, void *item);
14 int32_t hf_list_insert(struct list *lst, void *item, int32_t pos);
15 int32_t hf_list_remove(struct list *lst, int32_t pos);
16 void *hf_list_get(struct list *lst, int32_t pos);
17 int32_t hf_list_set(struct list *lst, void *item, int32_t pos);
18 int32_t hf_list_count(struct list *lst);
19 
20 #endif
int32_t hf_list_remove(struct list *lst, int32_t pos)
Removes an arbitrary node from a list.
Definition: list.c:113
struct list * hf_list_init(void)
Initializes a list.
Definition: list.c:28
void * hf_list_get(struct list *lst, int32_t pos)
Returns the address of the data belonging to a list node.
Definition: list.c:140
int32_t hf_list_count(struct list *lst)
Returns the number of nodes in a list.
Definition: list.c:186
List data structure.
Definition: list.h:7
int32_t hf_list_set(struct list *lst, void *item, int32_t pos)
Changes the address of the data belonging to a list node.
Definition: list.c:163
int32_t hf_list_append(struct list *lst, void *item)
Appends a new node to the end of the list.
Definition: list.c:50
int32_t hf_list_insert(struct list *lst, void *item, int32_t pos)
Inserts a new node to an arbitrary position in a list.
Definition: list.c:80
struct list * next
Definition: list.h:9
void * elem
Definition: list.h:8