2016-01-16 08:44:02 +00:00
|
|
|
#ifndef UC_LLIST_H
|
|
|
|
#define UC_LLIST_H
|
|
|
|
|
2017-01-20 13:13:21 +00:00
|
|
|
#include "unicorn/platform.h"
|
2016-01-16 08:44:02 +00:00
|
|
|
|
|
|
|
struct list_item {
|
|
|
|
struct list_item *next;
|
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct list {
|
|
|
|
struct list_item *head, *tail;
|
|
|
|
};
|
|
|
|
|
2017-06-16 05:22:38 +00:00
|
|
|
// create a new list
|
2016-01-16 08:44:02 +00:00
|
|
|
struct list *list_new(void);
|
2017-06-16 05:22:38 +00:00
|
|
|
|
|
|
|
// removed linked list nodes but does not free their content
|
2016-01-16 08:44:02 +00:00
|
|
|
void list_clear(struct list *list);
|
2017-06-16 05:22:38 +00:00
|
|
|
|
|
|
|
// insert a new item at the begin of the list.
|
|
|
|
void *list_insert(struct list *list, void *data);
|
|
|
|
|
|
|
|
// append a new item at the end of the list.
|
2016-01-16 08:44:02 +00:00
|
|
|
void *list_append(struct list *list, void *data);
|
2017-06-16 05:22:38 +00:00
|
|
|
|
|
|
|
// returns true if entry was removed, false otherwise
|
2016-01-16 08:44:02 +00:00
|
|
|
bool list_remove(struct list *list, void *data);
|
|
|
|
|
|
|
|
#endif
|