From ceb9ebd5a8ee6e013cf05b51a5a0ca2aac1ff3ee Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Mon, 13 Mar 2023 21:02:26 +0900 Subject: revise walk_src_path. In new walk_src_path, resolve dst path and resolve chunks are invoked when adding a path. --- src/list.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/list.h') diff --git a/src/list.h b/src/list.h index b2cfc76..20ce307 100644 --- a/src/list.h +++ b/src/list.h @@ -554,5 +554,20 @@ static inline int list_count(struct list_head *head) } +/** + * list_free_f - free items in a list with a function + * @head the heaf for your list. + * @f function that releases an item in the list. + */ +static inline void list_free_f(struct list_head *head, void (*f)(struct list_head *)) +{ + struct list_head *p, *n; + + list_for_each_safe(p, n, head) { + list_del(p); + f(p); + } +} + #endif -- cgit v1.2.3