diff options
Diffstat (limited to 'lib/llist.c')
-rw-r--r-- | lib/llist.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/llist.c b/lib/llist.c index 71a187db..2d5bc97a 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -5,8 +5,26 @@ #include "toys.h" +// Callback function to free data pointer of double_list or arg_list + +void llist_free_arg(void *node) +{ + struct arg_list *d = node; + + free(d->arg); + free(d); +} + +void llist_free_double(void *node) +{ + struct double_list *d = node; + + free(d->data); + free(d); +} + // Call a function (such as free()) on each element of a linked list. -void llist_traverse(void *list, void (*using)(void *data)) +void llist_traverse(void *list, void (*using)(void *node)) { void *old = list; |