2013-11-14 02:50:38 +08:00
|
|
|
#ifndef LIST_H
|
|
|
|
#define LIST_H
|
|
|
|
|
|
|
|
typedef struct node{
|
|
|
|
void *val;
|
|
|
|
struct node *next;
|
|
|
|
struct node *prev;
|
|
|
|
} node;
|
|
|
|
|
|
|
|
typedef struct list{
|
|
|
|
int size;
|
|
|
|
node *front;
|
|
|
|
node *back;
|
|
|
|
} list;
|
|
|
|
|
2019-02-15 00:28:23 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2013-11-14 02:50:38 +08:00
|
|
|
list *make_list();
|
|
|
|
int list_find(list *l, void *val);
|
|
|
|
|
|
|
|
void list_insert(list *, void *);
|
|
|
|
|
|
|
|
void **list_to_array(list *l);
|
|
|
|
|
2019-11-30 08:41:30 +08:00
|
|
|
void free_list_val(list *l);
|
2013-11-14 02:50:38 +08:00
|
|
|
void free_list(list *l);
|
|
|
|
void free_list_contents(list *l);
|
2018-05-23 23:27:18 +08:00
|
|
|
void free_list_contents_kvp(list *l);
|
2013-11-14 02:50:38 +08:00
|
|
|
|
2019-02-15 00:28:23 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2013-11-14 02:50:38 +08:00
|
|
|
#endif
|