2024-12-11 03:10:11 +01:00
|
|
|
#ifndef LLIST
|
|
|
|
#define LLIST
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
typedef struct llist {
|
|
|
|
void *data;
|
|
|
|
struct llist *next;
|
|
|
|
struct llist *prev;
|
|
|
|
int (*cmpFn)(void *a, void *b); // function that compares data
|
|
|
|
} llist;
|
|
|
|
|
|
|
|
// create new linked list with content(void* data) and cmpFN
|
|
|
|
llist *llistNew(void *data, int (*cmpFN)(void *a, void *b));
|
|
|
|
// create new node with data and append to tail of head
|
|
|
|
llist *llistAppend(llist *head, void *data);
|
|
|
|
// return llistNode that contains key or NULL
|
2024-12-11 11:01:37 +01:00
|
|
|
llist *llistGet(llist *head, void *key);
|
2024-12-11 03:10:11 +01:00
|
|
|
// TURE if llist contains key
|
|
|
|
bool llistContains(llist *head, void *key);
|
|
|
|
// free llist node (Does Not free data it contains!!)
|
|
|
|
void llistFree(llist *head);
|
|
|
|
|
|
|
|
#endif
|