new file: src/llist.c
new file: src/llist.h
This commit is contained in:
1 parent
4f867b29cb
commit
8db61cec44
2 files changed
+86
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
#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
|
||||
void *llistGet(llist *head, void *key);
|
||||
// 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
|
||||
Reference in new issue
Block a user