summaryrefslogtreecommitdiff
path: root/src/list.h
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-03-13 21:02:26 +0900
committerRyo Nakamura <upa@haeena.net>2023-03-13 21:02:26 +0900
commitceb9ebd5a8ee6e013cf05b51a5a0ca2aac1ff3ee (patch)
tree14dfe99b309e63ff1ea194affb8735f26ea96be0 /src/list.h
parent3810d6314dfa276f5f65509f9d204399f6db4e05 (diff)
revise walk_src_path.
In new walk_src_path, resolve dst path and resolve chunks are invoked when adding a path.
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h15
1 files changed, 15 insertions, 0 deletions
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