Rémi Bernon (@rbernon) commented about dlls/bluetoothapis/main.c:
if (find->devinfo == INVALID_HANDLE_VALUE)
{
free( find ); return NULL;
}
if (!BluetoothFindNextRadio( find, &device_ret ))
{
DWORD err;
err = GetLastError();
BluetoothFindRadioClose( find );
find = NULL;
SetLastError( err );
}
else
*radio = device_ret;
Fwiw, I think it better to keep short branches near the top, so that you can see the short if/else branches at once, and keep reading the longest ones if needed. Instead of finding about an else deep down and having to look back up to the if to find what the condition was.
Alternative in case of error handling, is to not have an else branch but to use an early return.