(!1967) 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 28fb627126
commit 4aaf4a6be2

View File

@ -2773,15 +2773,19 @@ GetMaster(DeviceIntPtr dev, int which)
return dev; return dev;
} }
if (master && which != MASTER_ATTACHED) { if (!master)
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) { return NULL;
if (master->type != MASTER_KEYBOARD)
master = GetPairedDevice(master); if (which == MASTER_ATTACHED)
} return master;
else {
if (master->type != MASTER_POINTER) if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) {
master = GetPairedDevice(master); if (master->type != MASTER_KEYBOARD)
} return GetPairedDevice(master);
}
else {
if (master->type != MASTER_POINTER)
return GetPairedDevice(master);
} }
return master; return master;