From 43e95ddbf46ea51a99a903eae9e6597cd4acef5d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 19 Jan 2025 04:04:44 +0900 Subject: [PATCH] capability-util: drop _cleanup_cap_free_charp_ Also moves cap_free_charpp() to test-cap-list.c, as it is used only there. --- src/basic/capability-util.h | 6 ------ src/test/test-cap-list.c | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/basic/capability-util.h b/src/basic/capability-util.h index 89c6cbec414..16dc8d18128 100644 --- a/src/basic/capability-util.h +++ b/src/basic/capability-util.h @@ -43,12 +43,6 @@ int keep_capability(cap_value_t cv); DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(cap_t, cap_free, NULL); #define _cleanup_cap_free_ _cleanup_(cap_freep) -static inline void cap_free_charpp(char **p) { - if (*p) - cap_free(*p); -} -#define _cleanup_cap_free_charp_ _cleanup_(cap_free_charpp) - static inline uint64_t all_capabilities(void) { return UINT64_MAX >> (63 - cap_last_cap()); } diff --git a/src/test/test-cap-list.c b/src/test/test-cap-list.c index 49be4a2d272..0fb2f31ed27 100644 --- a/src/test/test-cap-list.c +++ b/src/test/test-cap-list.c @@ -12,6 +12,11 @@ #include "strv.h" #include "tests.h" +static inline void cap_free_charpp(char **p) { + if (*p) + cap_free(*p); +} + /* verify the capability parser */ TEST(cap_list) { assert_se(!capability_to_name(-1)); @@ -46,7 +51,7 @@ TEST(cap_list) { assert_se(capability_from_name("-1") == -EINVAL); for (int i = 0; i < capability_list_length(); i++) { - _cleanup_cap_free_charp_ char *a = NULL; + _cleanup_(cap_free_charpp) char *a = NULL; const char *b; unsigned u; -- 2.47.3