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:
Enrico Weigelt, metux IT consult
2025-05-07 13:00:12 +02:00
parent 8c4a03242e
commit 04dbb99673

View File

@@ -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;