diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-25 13:35:55 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-26 06:32:35 +1000 |
commit | 3f2bc6564b38154117cc99700f6cd94100bfff0a (patch) | |
tree | b8d2b44833acaa7f3260282222c9885560d63e64 | |
parent | a39a15eb4c51a45de26d5cd1f4bed33ecc0ef060 (diff) |
Remove convoluted do { } while loop.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/mouse.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/mouse.c b/src/mouse.c index 32c58a1..3ed2b46 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -819,33 +819,29 @@ MousePickProtocol(InputInfoPtr pInfo, const char* device, const char *protocol, MouseProtocolID *protocolID_out) { MouseProtocolID protocolID = *protocolID_out; - Bool detected; protocolID = ProtocolNameToID(protocol); - do { - detected = TRUE; - switch (protocolID) { - case PROT_AUTO: - if (osInfo->SetupAuto) { - const char *osProt; - if ((osProt = osInfo->SetupAuto(pInfo,NULL))) { - MouseProtocolID id = ProtocolNameToID(osProt); - if (id == PROT_UNKNOWN || id == PROT_UNSUP) { - protocolID = id; - protocol = osProt; - detected = FALSE; - } - } + if (protocolID == PROT_AUTO) + { + const char *osProt; + if (osInfo->SetupAuto && (osProt = osInfo->SetupAuto(pInfo,NULL))) { + MouseProtocolID id = ProtocolNameToID(osProt); + if (id == PROT_UNKNOWN || id == PROT_UNSUP) { + protocolID = id; + protocol = osProt; } - break; + } + } + + switch (protocolID) { case PROT_UNKNOWN: /* Check for a builtin OS-specific protocol, * and call its PreInit. */ if (osInfo->CheckProtocol - && osInfo->CheckProtocol(protocol)) { + && osInfo->CheckProtocol(protocol)) { if (!device) - MouseFindDevice(pInfo, protocol); + MouseFindDevice(pInfo, protocol); if (osInfo->PreInit) { osInfo->PreInit(pInfo, protocol, 0); } @@ -861,8 +857,7 @@ MousePickProtocol(InputInfoPtr pInfo, const char* device, break; default: break; - } - } while (!detected); + } *protocolID_out = protocolID; |