xfree86: dga: use X_SEND_REPLY_SIMPLE() for simple replies

Use the X_SEND_REPLY_SIMPLE() macro for simple replies.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-26 10:33:54 +02:00
committed by Enrico Weigelt
parent ea3ef55be1
commit 9f8a9f4f8c

View File

@@ -1170,17 +1170,14 @@ XDGAResetProc(ExtensionEntry * extEntry)
static int
ProcXDGAQueryVersion(ClientPtr client)
{
xXDGAQueryVersionReply rep;
REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *) &rep);
return Success;
xXDGAQueryVersionReply rep = {
.majorVersion = SERVER_XDGA_MAJOR_VERSION,
.minorVersion = SERVER_XDGA_MINOR_VERSION
};
return X_SEND_REPLY_SIMPLE(client, rep);
}
static int
@@ -1244,7 +1241,6 @@ ProcXDGAQueryModes(ClientPtr client)
int i, num, size;
REQUEST(xXDGAQueryModesReq);
xXDGAQueryModesReply rep;
xXDGAModeInfo info;
XDGAModePtr mode;
@@ -1253,22 +1249,16 @@ ProcXDGAQueryModes(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.number = 0;
rep.sequenceNumber = client->sequence;
xXDGAQueryModesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence
};
if (!DGAAvailable(stuff->screen)) {
rep.number = 0;
rep.length = 0;
WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
return Success;
}
if (!DGAAvailable(stuff->screen))
return X_SEND_REPLY_SIMPLE(client, rep);
if (!(num = DGAGetModes(stuff->screen))) {
WriteToClient(client, sz_xXDGAQueryModesReply, (char *) &rep);
return Success;
}
if (!(num = DGAGetModes(stuff->screen)))
return X_SEND_REPLY_SIMPLE(client, rep);
if (!(mode = calloc(num, sizeof(XDGAModeRec))))
return BadAlloc;
@@ -1391,8 +1381,7 @@ ProcXDGASetMode(ClientPtr client)
DGA_SETCLIENT(stuff->screen, NULL);
DGASelectInput(stuff->screen, NULL, 0);
DGASetMode(stuff->screen, 0, &mode, &pPix);
WriteToClient(client, sz_xXDGASetModeReply, (char *) &rep);
return Success;
return X_SEND_REPLY_SIMPLE(client, rep);
}
if (Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
@@ -1577,7 +1566,6 @@ static int
ProcXDGAGetViewportStatus(ClientPtr client)
{
REQUEST(xXDGAGetViewportStatusReq);
xXDGAGetViewportStatusReply rep;
REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
@@ -1587,21 +1575,17 @@ ProcXDGAGetViewportStatus(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
xXDGAGetViewportStatusReply rep = {
.status = DGAGetViewportStatus(stuff->screen)
};
rep.status = DGAGetViewportStatus(stuff->screen);
WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *) &rep);
return Success;
return X_SEND_REPLY_SIMPLE(client, rep);
}
static int
ProcXDGASync(ClientPtr client)
{
REQUEST(xXDGASyncReq);
xXDGASyncReply rep;
REQUEST_SIZE_MATCH(xXDGASyncReq);
@@ -1611,14 +1595,10 @@ ProcXDGASync(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
xXDGASyncReply rep = { 0 };
DGASync(stuff->screen);
WriteToClient(client, sizeof(xXDGASyncReply), (char *) &rep);
return Success;
return X_SEND_REPLY_SIMPLE(client, rep);
}
static int
@@ -1646,7 +1626,6 @@ static int
ProcXDGAChangePixmapMode(ClientPtr client)
{
REQUEST(xXDGAChangePixmapModeReq);
xXDGAChangePixmapModeReply rep;
int x, y;
REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
@@ -1657,21 +1636,18 @@ ProcXDGAChangePixmapMode(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
x = stuff->x;
y = stuff->y;
if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
return BadMatch;
rep.x = x;
rep.y = y;
WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *) &rep);
xXDGAChangePixmapModeReply rep = {
.x = x,
.y = y
};
return Success;
return X_SEND_REPLY_SIMPLE(client, rep);
}
static int