Remove nested functions from videoinfo iterators.
This commit is contained in:
parent
e230377407
commit
3056d3e752
5 changed files with 39 additions and 28 deletions
|
@ -42,7 +42,7 @@ static int restore_needed;
|
|||
static grub_efi_handle_t gop_handle;
|
||||
|
||||
static int
|
||||
grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info));
|
||||
grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info, void *hook_arg), void *hook_arg);
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -52,6 +52,14 @@ static struct
|
|||
grub_uint8_t *offscreen;
|
||||
} framebuffer;
|
||||
|
||||
static int
|
||||
check_protocol_hook (const struct grub_video_mode_info *info __attribute__ ((unused)), void *hook_arg)
|
||||
{
|
||||
int *have_usable_mode = hook_arg;
|
||||
*have_usable_mode = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
check_protocol (void)
|
||||
|
@ -60,13 +68,6 @@ check_protocol (void)
|
|||
grub_efi_uintn_t num_handles, i;
|
||||
int have_usable_mode = 0;
|
||||
|
||||
auto int hook (const struct grub_video_mode_info *info);
|
||||
int hook (const struct grub_video_mode_info *info __attribute__ ((unused)))
|
||||
{
|
||||
have_usable_mode = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL,
|
||||
&graphics_output_guid, NULL, &num_handles);
|
||||
if (!handles || num_handles == 0)
|
||||
|
@ -77,7 +78,7 @@ check_protocol (void)
|
|||
gop_handle = handles[i];
|
||||
gop = grub_efi_open_protocol (gop_handle, &graphics_output_guid,
|
||||
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
grub_video_gop_iterate (hook);
|
||||
grub_video_gop_iterate (check_protocol_hook, &have_usable_mode);
|
||||
if (have_usable_mode)
|
||||
{
|
||||
grub_free (handles);
|
||||
|
@ -256,7 +257,7 @@ grub_video_gop_fill_mode_info (unsigned mode,
|
|||
}
|
||||
|
||||
static int
|
||||
grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info))
|
||||
grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info, void *hook_arg), void *hook_arg)
|
||||
{
|
||||
unsigned mode;
|
||||
|
||||
|
@ -282,7 +283,7 @@ grub_video_gop_iterate (int (*hook) (const struct grub_video_mode_info *info))
|
|||
grub_errno = GRUB_ERR_NONE;
|
||||
continue;
|
||||
}
|
||||
if (hook (&mode_info))
|
||||
if (hook (&mode_info, hook_arg))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue