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

@ -483,7 +483,7 @@ grub_ohci_inithw (void)
static int
grub_ohci_iterate (int (*hook) (grub_usb_controller_t dev))
grub_ohci_iterate (grub_usb_controller_iterate_hook_t hook, void *hook_data)
{
struct grub_ohci *o;
struct grub_usb_controller dev;
@ -491,7 +491,7 @@ grub_ohci_iterate (int (*hook) (grub_usb_controller_t dev))
for (o = ohci; o; o = o->next)
{
dev.data = o;
if (hook (&dev))
if (hook (&dev, hook_data))
return 1;
}