Elizabeth Figura (@zfigura) commented about dlls/bluetoothapis/main.c:
+{
- BTH_DEVICE_INFO_LIST *list;
- BOOL success;
- DWORD bytes, size;
- void *ptr;
- list = malloc( sizeof( *list ) );
- if (!list)
- {
SetLastError( ERROR_OUTOFMEMORY );
return FALSE;
- }
- success = DeviceIoControl( radio, IOCTL_BTH_GET_DEVICE_INFO, list, sizeof( *list ), list, sizeof( *list ), &bytes,
NULL );
- if (!success)
As usual I'm going to go no further than a recommendation made when bikeshedding, but the way this line is wrapped seems unnecessarily ugly. Also, the use of a temporary boolean variable (as well as very frequently in other places in the code) instead of just putting the expression inside the if strikes me as wasting space.
Also, do we actually need to pass input here? It looks wrong, and Microsoft's bthioctl.h suggests we don't. The MSDN documentation for this suggests otherwise, but I think that's a side effect of it being written for drivers, where buffered ioctls basically overload the same pointer to refer to the input and output length.