Define array cleanup funcs through macros (#41559)
This commit is contained in:
+4
-11
@@ -412,14 +412,7 @@ static void named_addon_done(NamedAddon *a) {
|
||||
iovec_done(&a->blob);
|
||||
}
|
||||
|
||||
static void named_addon_free_many(NamedAddon *a, size_t n) {
|
||||
assert(a || n == 0);
|
||||
|
||||
FOREACH_ARRAY(i, a, n)
|
||||
named_addon_done(i);
|
||||
|
||||
free(a);
|
||||
}
|
||||
static DEFINE_ARRAY_FREE_FUNC(named_addon_free_array, NamedAddon, named_addon_done);
|
||||
|
||||
static void install_addon_devicetrees(
|
||||
struct devicetree_state *dt_state,
|
||||
@@ -1294,9 +1287,9 @@ static EFI_STATUS run(EFI_HANDLE image) {
|
||||
|
||||
/* Now that we have the UKI sections loaded, also load global first and then local (per-UKI)
|
||||
* addons. The data is loaded at once, and then used later. */
|
||||
CLEANUP_ARRAY(dt_addons, n_dt_addons, named_addon_free_many);
|
||||
CLEANUP_ARRAY(initrd_addons, n_initrd_addons, named_addon_free_many);
|
||||
CLEANUP_ARRAY(ucode_addons, n_ucode_addons, named_addon_free_many);
|
||||
CLEANUP_ARRAY(dt_addons, n_dt_addons, named_addon_free_array);
|
||||
CLEANUP_ARRAY(initrd_addons, n_initrd_addons, named_addon_free_array);
|
||||
CLEANUP_ARRAY(ucode_addons, n_ucode_addons, named_addon_free_array);
|
||||
load_all_addons(image, loaded_image, uname, &cmdline_addons, &dt_addons, &n_dt_addons, &initrd_addons, &n_initrd_addons, &ucode_addons, &n_ucode_addons);
|
||||
|
||||
/* If we have any extra command line to add via PE addons, load them now and append, and measure the
|
||||
|
||||
Reference in New Issue
Block a user