summaryrefslogtreecommitdiffstats
path: root/dlink.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 11:40:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-09 11:40:59 +0000
commitad73653d36c9bd59872479e3c41f8942c70945b9 (patch)
treef184315b3ad68109e86aa4bd5bba3de919bfa3e3 /dlink.c
parentAdding upstream version 4.3+20240723. (diff)
downloadmdadm-ad73653d36c9bd59872479e3c41f8942c70945b9.tar.xz
mdadm-ad73653d36c9bd59872479e3c41f8942c70945b9.zip
Adding upstream version 4.3+20241108.upstream/4.3+20241108
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dlink.c')
-rw-r--r--dlink.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/dlink.c b/dlink.c
index 69aa7aa..3463367 100644
--- a/dlink.c
+++ b/dlink.c
@@ -26,6 +26,21 @@ void dl_free(void *v)
free(vv-1);
}
+void dl_free_all(void *head)
+{
+ /* The list head is linked with the list tail so in order to free
+ * all the elements properly there is a need to keep starting point.
+ */
+ void *d = dl_next(head), *next;
+
+ while (d != head) {
+ next = dl_next(d);
+ dl_free(d);
+ d = next;
+ }
+ dl_free(head);
+}
+
void dl_init(void *v)
{
dl_next(v) = v;