From 953261e160419f53370dcfae950c8d259a23f17d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 22 Aug 2025 19:37:51 +0200 Subject: [PATCH] glx: xtest: use X_SEND_REPLY_SIMPLE() Use X_SEND_REPLY_SIMPLE() for sending out simple replies. Signed-off-by: Enrico Weigelt, metux IT consult --- glx/glxcmds.c | 18 ++---------------- glx/vndcmds.c | 18 ++---------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 9b935ab687..ba4b16fc59 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -713,19 +713,10 @@ __glXDisp_IsDirect(__GLXclientState * cl, GLbyte * pc) return err; xGLXIsDirectReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .isDirect = glxc->isDirect }; - if (client->swapped) { - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - } - WriteToClient(client, sizeof(xGLXIsDirectReply), &reply); - + X_SEND_REPLY_SIMPLE(client, reply); return Success; } @@ -748,22 +739,17 @@ __glXDisp_QueryVersion(__GLXclientState * cl, GLbyte * pc) ** implementation the server just returns its version number. */ xGLXQueryVersionReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .majorVersion = SERVER_GLX_MAJOR_VERSION, .minorVersion = SERVER_GLX_MINOR_VERSION }; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.majorVersion); __GLX_SWAP_INT(&reply.minorVersion); } - WriteToClient(client, sizeof(xGLXQueryVersionReply), &reply); + X_SEND_REPLY_SIMPLE(client, reply); return Success; } diff --git a/glx/vndcmds.c b/glx/vndcmds.c index 3f9587a88d..cae4c88aa8 100644 --- a/glx/vndcmds.c +++ b/glx/vndcmds.c @@ -87,17 +87,6 @@ static GlxServerDispatchProc GetVendorDispatchFunc(CARD8 opcode, CARD32 vendorCo return DispatchBadRequest; } -static void SetReplyHeader(ClientPtr client, void *replyPtr) -{ - xGenericReply *rep = (xGenericReply *) replyPtr; - rep->type = X_Reply; - rep->sequenceNumber = client->sequence; - if (client->swapped) { - swaps(&rep->sequenceNumber); - } - rep->length = 0; -} - /* Include the trivial dispatch handlers */ #include "vnd_dispatch_stubs.c" @@ -106,11 +95,10 @@ static int dispatch_GLXQueryVersion(ClientPtr client) xGLXQueryVersionReply reply; REQUEST_SIZE_MATCH(xGLXQueryVersionReq); - SetReplyHeader(client, &reply); reply.majorVersion = GlxCheckSwap(client, 1); reply.minorVersion = GlxCheckSwap(client, 4); - WriteToClient(client, sizeof(xGLXQueryVersionReply), &reply); + X_SEND_REPLY_SIMPLE(client, reply); return Success; } @@ -213,8 +201,6 @@ static int CommonMakeCurrent(ClientPtr client, readdrawable = GlxCheckSwap(client, readdrawable); context = GlxCheckSwap(client, context); - SetReplyHeader(client, &reply); - if (oldContextTag != 0) { oldTag = GlxLookupContextTag(client, oldContextTag); if (oldTag == NULL) { @@ -271,7 +257,7 @@ static int CommonMakeCurrent(ClientPtr client, } reply.contextTag = GlxCheckSwap(client, reply.contextTag); - WriteToClient(client, sizeof(xGLXMakeCurrentReply), &reply); + X_SEND_REPLY_SIMPLE(client, reply); return Success; }