[PATCH 08/10] xfree86: nest loops instead of 0x1 pointers.
Peter Hutterer
peter.hutterer at who-t.net
Sun Jul 3 23:09:14 PDT 2011
If we find the core device, move all other device pointers forward right
then and there. The break will jump out of the top loop.
They had a special on braces today, so I added some for readability (and
fixed up tab vs space indentation.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
hw/xfree86/common/xf86Config.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 74a7702..4a76a2d 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1139,15 +1139,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* removed.
*/
if (corePointer) {
- for (devs = servlayoutp->inputs; devs && *devs; devs++)
- if (*devs == corePointer)
- {
- free(*devs);
- *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop*/
+ for (devs = servlayoutp->inputs; devs && *devs; devs++) {
+ if (*devs == corePointer) {
+ free(*devs);
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
break;
- }
- for (; devs && *devs; devs++)
- devs[0] = devs[1];
+ }
+ }
count--;
}
corePointer = NULL;
@@ -1283,15 +1282,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* removed.
*/
if (coreKeyboard) {
- for (devs = servlayoutp->inputs; devs && *devs; devs++)
- if (*devs == coreKeyboard)
- {
- free(*devs);
- *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop */
+ for (devs = servlayoutp->inputs; devs && *devs; devs++) {
+ if (*devs == coreKeyboard) {
+ free(*devs);
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
break;
- }
- for (; devs && *devs; devs++)
- devs[0] = devs[1];
+ }
+ }
count--;
}
coreKeyboard = NULL;
--
1.7.5.4
More information about the xorg-devel
mailing list