mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-27 14:28:47 +00:00
dix: devices: refine NULL checks in GetMaster()
The checking / branchin isn't entirely trivial to understand, and the analyzer also gets confused. So rewrite it in an simpler way that's easier to understand both the human reader as well as the analyzer. (and so get rid of yet another false alarm) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -2773,15 +2773,19 @@ GetMaster(DeviceIntPtr dev, int which)
|
||||
return dev;
|
||||
}
|
||||
|
||||
if (master && which != MASTER_ATTACHED) {
|
||||
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) {
|
||||
if (master->type != MASTER_KEYBOARD)
|
||||
master = GetPairedDevice(master);
|
||||
}
|
||||
else {
|
||||
if (master->type != MASTER_POINTER)
|
||||
master = GetPairedDevice(master);
|
||||
}
|
||||
if (!master)
|
||||
return NULL;
|
||||
|
||||
if (which == MASTER_ATTACHED)
|
||||
return master;
|
||||
|
||||
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) {
|
||||
if (master->type != MASTER_KEYBOARD)
|
||||
return GetPairedDevice(master);
|
||||
}
|
||||
else {
|
||||
if (master->type != MASTER_POINTER)
|
||||
return GetPairedDevice(master);
|
||||
}
|
||||
|
||||
return master;
|
||||
|
||||
Reference in New Issue
Block a user