diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/introduce-ordered_set_clear-free-with-destructor.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/introduce-ordered_set_clear-free-with-destructor.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/introduce-ordered_set_clear-free-with-destructor.patch b/meta/recipes-core/systemd/systemd/introduce-ordered_set_clear-free-with-destructor.patch new file mode 100644 index 0000000000..42b6e05b55 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/introduce-ordered_set_clear-free-with-destructor.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From d38a6476aad3f2cc80a2a4bc11f3898cc06a70f5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yu Watanabe <watanabe.yu+github@gmail.com> | ||
3 | Date: Mon, 26 Apr 2021 23:52:40 +0900 | ||
4 | Subject: [PATCH] ordered-set: introduce | ||
5 | ordered_set_clear/free_with_destructor() | ||
6 | |||
7 | Upstream-Status: Backport [https://github.com/systemd/systemd-stable/commit/d38a6476aad3f2cc80a2a4bc11f3898cc06a70f5] | ||
8 | Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com> | ||
9 | |||
10 | --- | ||
11 | src/basic/ordered-set.h | 11 +++++++++++ | ||
12 | 1 file changed, 11 insertions(+) | ||
13 | |||
14 | diff --git a/src/basic/ordered-set.h b/src/basic/ordered-set.h | ||
15 | index a377f20b1f..64df41766f 100644 | ||
16 | --- a/src/basic/ordered-set.h | ||
17 | +++ b/src/basic/ordered-set.h | ||
18 | @@ -63,6 +63,17 @@ void ordered_set_print(FILE *f, const char *field, OrderedSet *s); | ||
19 | #define ORDERED_SET_FOREACH(e, s, i) \ | ||
20 | for ((i) = ITERATOR_FIRST; ordered_set_iterate((s), &(i), (void**)&(e)); ) | ||
21 | |||
22 | +#define ordered_set_clear_with_destructor(s, f) \ | ||
23 | + ({ \ | ||
24 | + OrderedSet *_s = (s); \ | ||
25 | + void *_item; \ | ||
26 | + while ((_item = ordered_set_steal_first(_s))) \ | ||
27 | + f(_item); \ | ||
28 | + _s; \ | ||
29 | + }) | ||
30 | +#define ordered_set_free_with_destructor(s, f) \ | ||
31 | + ordered_set_free(ordered_set_clear_with_destructor(s, f)) | ||
32 | + | ||
33 | DEFINE_TRIVIAL_CLEANUP_FUNC(OrderedSet*, ordered_set_free); | ||
34 | DEFINE_TRIVIAL_CLEANUP_FUNC(OrderedSet*, ordered_set_free_free); | ||
35 | |||