From 924540c44dbef1509bd670f0d86ab2010ba35acf Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 17 Jul 2024 12:52:01 +0200 Subject: [PATCH] (!1601) Xext: xres: ProcXResQueryClients() simplify payload write out Collect the few bits in a local array, so one WriteToClient() call is sufficient. That's also easing further simplifications in upcoming commits. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xres.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Xext/xres.c b/Xext/xres.c index 726fed41a..e540c7f1b 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -242,21 +242,22 @@ ProcXResQueryClients(ClientPtr client) } WriteToClient(client, sizeof(xXResQueryClientsReply), &rep); - if (num_clients) { - xXResClient scratch; + xXResClient scratch[num_clients]; + if (num_clients) { for (i = 0; i < num_clients; i++) { - scratch.resource_base = clients[current_clients[i]]->clientAsMask; - scratch.resource_mask = RESOURCE_ID_MASK; + scratch[i].resource_base = clients[current_clients[i]]->clientAsMask; + scratch[i].resource_mask = RESOURCE_ID_MASK; if (client->swapped) { - swapl(&scratch.resource_base); - swapl(&scratch.resource_mask); + swapl(&scratch[i].resource_base); + swapl(&scratch[i].resource_mask); } - WriteToClient(client, sz_xXResClient, &scratch); } } + WriteToClient(client, sizeof(scratch), scratch); + return Success; }