Remove nested functions from USB iterators.

* include/grub/usb.h (grub_usb_iterate_hook_t): New type.
(grub_usb_controller_iterate_hook_t): Likewise.
(grub_usb_iterate): Add hook_data argument.
(grub_usb_controller_iterate): Likewise.
(struct grub_usb_controller_dev.iterate): Likewise.

Update all implementations and callers.
This commit is contained in:
Colin Watson 2013-01-21 21:02:24 +00:00
parent 18288f17ac
commit 5fdbaed168
9 changed files with 108 additions and 75 deletions

View file

@ -870,7 +870,7 @@ fail:
}
static int
grub_ehci_iterate (int (*hook) (grub_usb_controller_t dev))
grub_ehci_iterate (grub_usb_controller_iterate_hook_t hook, void *hook_data)
{
struct grub_ehci *e;
struct grub_usb_controller dev;
@ -878,7 +878,7 @@ grub_ehci_iterate (int (*hook) (grub_usb_controller_t dev))
for (e = ehci; e; e = e->next)
{
dev.data = e;
if (hook (&dev))
if (hook (&dev, hook_data))
return 1;
}