capability-util: drop _cleanup_cap_free_charp_

Also moves cap_free_charpp() to test-cap-list.c, as it is used only
there.
This commit is contained in:
Yu Watanabe
2025-01-19 04:04:47 +09:00
parent fe5a1afb67
commit 43e95ddbf4
2 changed files with 6 additions and 7 deletions
+6 -1
View File
@@ -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;