From 7e99e3337220c7ad92dd74c032c8ff4f4f2d3c9d Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 8 Mar 2016 18:11:32 +1000 Subject: [PATCH] * filelist.[ch]: add f2b_filelist_destroy() --- src/filelist.c | 11 +++++++++++ src/filelist.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/filelist.c b/src/filelist.c index 89244ef..653f97d 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -39,3 +39,14 @@ f2b_filelist_from_glob(const char *pattern) { globfree(&globbuf); return files; } + +void +f2b_filelist_destroy(f2b_logfile_t *list) { + f2b_logfile_t *next = NULL; + + for (; list != NULL; list = next) { + next = list->next; + f2b_logfile_close(list); + free(list); + } +} diff --git a/src/filelist.h b/src/filelist.h index ac2f554..e35cea0 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -7,4 +7,7 @@ f2b_filelist_from_glob(const char *pattern); f2b_logfile_t * f2b_filelist_append(f2b_logfile_t *list, f2b_logfile_t *file); +void +f2b_filelist_destroy(f2b_logfile_t *list); + #endif /* FILELIST_H_ */