From 7eabb5ca61c2115731366aee96f46cd99110d132 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 19 Jan 2025 04:18:04 +0900 Subject: [PATCH] boot: introduce _cleanup_strv_free_ --- src/boot/boot.c | 2 +- src/boot/cpio.c | 2 +- src/boot/stub.c | 2 +- src/boot/util.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/boot/boot.c b/src/boot/boot.c index f785a6daf41..27512612346 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -683,7 +683,7 @@ static bool menu_run( bool new_mode = true, clear = true; bool refresh = true, highlight = false; size_t x_start = 0, y_start = 0, y_status = 0, x_max, y_max; - _cleanup_(strv_freep) char16_t **lines = NULL; + _cleanup_strv_free_ char16_t **lines = NULL; _cleanup_free_ char16_t *clearline = NULL, *separator = NULL, *status = NULL; uint64_t timeout_efivar_saved = config->timeout_sec_efivar; uint32_t timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec; diff --git a/src/boot/cpio.c b/src/boot/cpio.c index 6cbecc53aa2..fc5e303d7e6 100644 --- a/src/boot/cpio.c +++ b/src/boot/cpio.c @@ -318,7 +318,7 @@ EFI_STATUS pack_cpio( size_t dirent_size = 0, buffer_size = 0, n_items = 0, n_allocated = 0; _cleanup_free_ char16_t *rel_dropin_dir = NULL; _cleanup_free_ EFI_FILE_INFO *dirent = NULL; - _cleanup_(strv_freep) char16_t **items = NULL; + _cleanup_strv_free_ char16_t **items = NULL; _cleanup_free_ void *buffer = NULL; uint32_t inode = 1; /* inode counter, so that each item gets a new inode */ EFI_STATUS err; diff --git a/src/boot/stub.c b/src/boot/stub.c index e1ccb34a0b8..e74b7db95ad 100644 --- a/src/boot/stub.c +++ b/src/boot/stub.c @@ -547,7 +547,7 @@ static EFI_STATUS load_addons( NamedAddon **ucode_addons, /* Ditto */ size_t *n_ucode_addons) { - _cleanup_(strv_freep) char16_t **items = NULL; + _cleanup_strv_free_ char16_t **items = NULL; _cleanup_file_close_ EFI_FILE *root = NULL; size_t n_items = 0, n_allocated = 0; EFI_STATUS err; diff --git a/src/boot/util.h b/src/boot/util.h index 17af86d41c6..49ba1196137 100644 --- a/src/boot/util.h +++ b/src/boot/util.h @@ -169,6 +169,8 @@ static inline void strv_freep(char16_t ***p) { strv_free(*p); } +#define _cleanup_strv_free_ _cleanup_(strv_freep) + EFI_STATUS open_directory(EFI_FILE *root_dir, const char16_t *path, EFI_FILE **ret); /* Conversion between EFI_PHYSICAL_ADDRESS and pointers is not obvious. The former is always 64-bit, even on -- 2.47.3