xkb: ProcXkbGetCompatMap(): clean up variable declarations

Declara only what's really needed, where it's needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-19 11:36:57 +02:00
committed by Enrico Weigelt
parent 743838456d
commit e197043099

View File

@@ -2794,31 +2794,23 @@ XkbAssembleCompatMap(ClientPtr client,
int
ProcXkbGetCompatMap(ClientPtr client)
{
DeviceIntPtr dev;
XkbDescPtr xkb;
XkbCompatMapPtr compat;
REQUEST(xkbGetCompatMapReq);
REQUEST_SIZE_MATCH(xkbGetCompatMapReq);
if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
DeviceIntPtr dev;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb = dev->key->xkbInfo->desc;
compat = xkb->compat;
XkbCompatMapPtr compat = dev->key->xkbInfo->desc->compat;
CARD16 firstSI = stuff->firstSI;
CARD16 nSI = stuff->nSI;
xkbGetCompatMapReply rep = {
.deviceID = dev->id,
.firstSI = stuff->firstSI,
.nSI = stuff->nSI,
.nTotalSI = compat->num_si,
.groups = stuff->groups,
};
if (stuff->getAllSI) {
rep.firstSI = 0;
rep.nSI = compat->num_si;
firstSI = 0;
nSI = compat->num_si;
}
else if ((((unsigned) stuff->nSI) > 0) &&
((unsigned) (stuff->firstSI + stuff->nSI - 1) >= compat->num_si)) {
@@ -2826,6 +2818,14 @@ ProcXkbGetCompatMap(ClientPtr client)
return BadValue;
}
xkbGetCompatMapReply rep = {
.deviceID = dev->id,
.firstSI = firstSI,
.nSI = nSI,
.nTotalSI = compat->num_si,
.groups = stuff->groups,
};
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
XkbAssembleCompatMap(client, compat, rep, &rpcbuf);