dix: write out X_InternAtom reply directly

No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-03 17:45:35 +02:00
parent 9541233f8d
commit 56f1c26056
4 changed files with 16 additions and 24 deletions

View File

@ -1090,18 +1090,22 @@ ProcInternAtom(ClientPtr client)
}
tchar = (char *) &stuff[1];
atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
if (atom != BAD_RESOURCE) {
xInternAtomReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.atom = atom
};
WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
return Success;
}
else
if (atom == BAD_RESOURCE)
return BadAlloc;
xInternAtomReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.atom = atom
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.atom);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}
int

View File

@ -183,14 +183,6 @@ SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->atom);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply * pRep)
{

View File

@ -731,7 +731,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd, /* 15 */
(ReplySwapPtr) SInternAtomReply,
ReplyNotSwappd,
(ReplySwapPtr) SGetAtomNameReply,
ReplyNotSwappd,
ReplyNotSwappd,

View File

@ -42,10 +42,6 @@ extern void SGenericReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGenericReply * /* pRep */ );
extern void SInternAtomReply(ClientPtr /* pClient */ ,
int /* size */ ,
xInternAtomReply * /* pRep */ );
extern void SGetAtomNameReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetAtomNameReply * /* pRep */ );