From 7db55a0806c82bd4143c8bf1b8eb2b62e456ad9a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 May 2009 14:38:25 +1000 Subject: [PATCH] dix: remove superfluous loop in change_modmap. A device can only be attached to a single master device. So instead of looping and searching for the master device, we can just use dev->u.master directly. Signed-off-by: Peter Hutterer --- dix/inpututils.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dix/inpututils.c b/dix/inpututils.c index c6300880b..152214506 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -275,14 +275,10 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap, do_modmap_change(client, tmp, modmap); } } - else { - for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { - if (tmp->isMaster && tmp->u.lastSlave == dev) { - /* If this fails, expect the results to be weird. */ - if (check_modmap_change(client, tmp, modmap)) - do_modmap_change(client, tmp, modmap); - } - } + else if (dev->u.master && dev->u.master->u.lastSlave == dev) { + /* If this fails, expect the results to be weird. */ + if (check_modmap_change(client, dev->u.master, modmap)) + do_modmap_change(client, dev->u.master, modmap); } return Success;