From f3ac92a41b9e85a0cfba011812b637b1f3ae2529 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 25 Oct 2010 13:35:55 +1000 Subject: Remove convoluted do { } while loop. Signed-off-by: Peter Hutterer Reviewed-by: Alan Coopersmith Tested-by: Alan Coopersmith --- src/mouse.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src') 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; -- cgit v1.2.3