diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-07-04 14:26:13 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-08-22 15:56:48 +1000 |
commit | 7354f607833c69626d8692bc5176b18ea1cf6263 (patch) | |
tree | a3a19049686bc58f55cb98c967a8ca2c7f240dea | |
parent | 5669aa2d24dff9ab276e5f74a09f97ec77b90e75 (diff) |
xfree86: nest loops instead of 0x1 pointers.
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@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | 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 2dba088ad..c7d567d55 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; @@ -1285,15 +1284,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; |