diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-09 11:40:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-09 11:40:59 +0000 |
commit | ad73653d36c9bd59872479e3c41f8942c70945b9 (patch) | |
tree | f184315b3ad68109e86aa4bd5bba3de919bfa3e3 /dlink.c | |
parent | Adding upstream version 4.3+20240723. (diff) | |
download | mdadm-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.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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; |