diff options
Diffstat (limited to 'src/ll.h')
| -rw-r--r-- | src/ll.h | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -21,11 +21,11 @@ | |||
| 21 | /* TODO: Implement a way to register a set of alloc functions to a linked list so I can give it arenas for memory allocation | 21 | /* TODO: Implement a way to register a set of alloc functions to a linked list so I can give it arenas for memory allocation |
| 22 | // instead of just xcalloc */ | 22 | // instead of just xcalloc */ |
| 23 | 23 | ||
| 24 | typedef int (*dll_freecb)(void*); | 24 | typedef void (*dll_freecb)(void*); |
| 25 | typedef struct dlinked dlinkedlist; | 25 | typedef struct dlinked dlinkedlist; |
| 26 | 26 | ||
| 27 | dlinkedlist * dlinkedlist_init(void); | 27 | dlinkedlist * dlinkedlist_init(void); |
| 28 | int dlinkedlist_free(dlinkedlist **ll); | 28 | void dlinkedlist_free(dlinkedlist *ll); |
| 29 | int dlinkedlist_append(dlinkedlist * const ll, void *data, dll_freecb fcb); | 29 | int dlinkedlist_append(dlinkedlist * const ll, void *data, dll_freecb fcb); |
| 30 | int dlinkedlist_prepend(dlinkedlist * const ll, void *data, dll_freecb fcb); | 30 | int dlinkedlist_prepend(dlinkedlist * const ll, void *data, dll_freecb fcb); |
| 31 | int dlinkedlist_insert(dlinkedlist * const ll, void *data, dll_freecb fcb, int index); | 31 | int dlinkedlist_insert(dlinkedlist * const ll, void *data, dll_freecb fcb, int index); |
| @@ -35,4 +35,6 @@ int dlinkedlist_remove(dlinkedlist * const ll, int index); | |||
| 35 | int dlinkedlist_size(const dlinkedlist * const ll); | 35 | int dlinkedlist_size(const dlinkedlist * const ll); |
| 36 | #define dlinkedlist_isempty(ll) (dlinkedlist_size((ll)) == 0) | 36 | #define dlinkedlist_isempty(ll) (dlinkedlist_size((ll)) == 0) |
| 37 | 37 | ||
| 38 | int dlinkedlist_foreach(dlinkedlist *ll, int (*callback)(void*)); | ||
| 39 | |||
| 38 | #endif \ No newline at end of file | 40 | #endif \ No newline at end of file |
