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 4d3d4a34ec
commit af71108cd3

View File

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