mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 18:54:38 +00:00
randr: ProcRRListOutputProperties(): use SwapShort()/SwapLong()
Simplify reply payload preparation and sendout by using SwapShort() and SwapLong() instead of WriteToClientSwapped() and callbacks. This also allows even further simplifications by using generic macros for the request send path. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -416,7 +416,6 @@ int
|
||||
ProcRRListOutputProperties(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRListOutputPropertiesReq);
|
||||
Atom *pAtoms = NULL;
|
||||
int numProps = 0;
|
||||
RROutputPtr output;
|
||||
RRPropertyPtr prop;
|
||||
@@ -427,9 +426,6 @@ ProcRRListOutputProperties(ClientPtr client)
|
||||
|
||||
for (prop = output->properties; prop; prop = prop->next)
|
||||
numProps++;
|
||||
if (numProps)
|
||||
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
|
||||
return BadAlloc;
|
||||
|
||||
xRRListOutputPropertiesReply rep = {
|
||||
.type = X_Reply,
|
||||
@@ -442,7 +438,8 @@ ProcRRListOutputProperties(ClientPtr client)
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.nAtoms);
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
|
||||
|
||||
Atom pAtoms[numProps];
|
||||
|
||||
if (numProps) {
|
||||
/* Copy property name atoms to reply buffer */
|
||||
@@ -450,10 +447,12 @@ ProcRRListOutputProperties(ClientPtr client)
|
||||
for (prop = output->properties; prop; prop = prop->next)
|
||||
*temppAtoms++ = prop->propertyName;
|
||||
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
|
||||
free(pAtoms);
|
||||
if (client->swapped) SwapLongs(pAtoms, numProps);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
|
||||
WriteToClient(client, sizeof(pAtoms), pAtoms);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user