From e197043099103bb5616f6d68bbfbf06f80fd8ad7 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 19 Aug 2025 11:36:57 +0200 Subject: [PATCH] xkb: ProcXkbGetCompatMap(): clean up variable declarations Declara only what's really needed, where it's needed. Signed-off-by: Enrico Weigelt, metux IT consult --- xkb/xkb.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index a3fdda759..a00f2ded1 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -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);