Hello. On Wed, 2011-08-31 at 23:26, Tormod Volden wrote: > From: Tormod Volden <debian.tor...@gmail.com> > > Limit the scope of some variables, get rid of others. > Continue as soon as possible on non-match. > --- > src/main.c | 20 +++++++------------- > 1 files changed, 7 insertions(+), 13 deletions(-) > > diff --git a/src/main.c b/src/main.c > index 9fbaed9..e547a05 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -293,32 +293,26 @@ static int count_dfu_interfaces(libusb_device *dev) > static int iterate_dfu_devices(libusb_context *ctx, struct dfu_if *dif, > int (*action)(struct libusb_device *dev, void *user), void *user) > { > - struct libusb_device_descriptor desc; > - struct libusb_device *dev; > libusb_device **list; > ssize_t num_devs, i; > > - dev = NULL; > num_devs = libusb_get_device_list(ctx, &list); > - > - /* Walk the tree and find our device. */ > for (i = 0; i < num_devs; ++i) { > - uint8_t bnum = libusb_get_bus_number(list[i]); > - uint8_t dnum = libusb_get_device_address(list[i]); > - > int retval; > - dev = list[i]; > - libusb_get_device_descriptor(list[i], &desc); > + struct libusb_device_descriptor desc; > + struct libusb_device *dev = list[i]; > > + if (dif && (dif->flags & DFU_IFF_DEVNUM) && > + (libusb_get_bus_number(dev) != dif->bus || > + libusb_get_device_address(dev) != dif->devnum))
General a nice cleanup, but I find this if clause pretty hard to follow in all detail. :) But I'm in good mood and happy to see all your contributions so I applied it as-is. :) regards Stefan Schmidt _______________________________________________ devel mailing list devel@lists.openmoko.org https://lists.openmoko.org/mailman/listinfo/devel