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 | f3ac92a41b9e85a0cfba011812b637b1f3ae2529 (patch) | |
tree | b8d2b44833acaa7f3260282222c9885560d63e64 | |
parent | fac47e7df6f719b1fce5341b343cabcbe150b52f (diff) |
Remove convoluted do { } while loop.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-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; |