dix: ProcListHosts(): use x_rpcbuf_t

Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-02 19:32:02 +02:00
committed by Enrico Weigelt
parent 15340ce053
commit 8cfcb072d2

View File

@@ -3288,13 +3288,12 @@ ProcListHosts(ClientPtr client)
return result;
xListHostsReply rep = {
.type = X_Reply,
.enabled = enabled,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
.nHosts = nHosts
};
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
if (client->swapped) {
char *bufT = pdata;
char *endbuf = bufT + len;
@@ -3306,16 +3305,13 @@ ProcListHosts(ClientPtr client)
bufT += sizeof(xHostEntry) + pad_to_int32(l1);
}
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.nHosts);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, len, pdata);
x_rpcbuf_write_CARD8s(&rpcbuf, pdata, len);
free(pdata);
return Success;
return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
}
int