From 08d44466a80140effa2e99083c919a853e075d51 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 15 Jul 2025 04:40:38 +0200 Subject: [PATCH] xv: inline SWriteFormat() Instead of complex macro machinery, just move the conditional swapping directly into ProcXvQueryAdaptors(). Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xvdisp.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 2e981559f..b9aadff68 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -54,15 +54,6 @@ SOFTWARE. unsigned long XvXRTPort; #endif /* XINERAMA */ -static int -SWriteFormat(ClientPtr client, xvFormat * pFormat) -{ - swapl(&pFormat->visual); - WriteToClient(client, sz_xvFormat, pFormat); - - return Success; -} - static int SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt) { @@ -179,10 +170,6 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep) if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \ else WriteToClient(_c, sz_xvAttributeInfo, _d) -#define _WriteFormat(_c,_d) \ - if ((_c)->swapped) SWriteFormat(_c, _d); \ - else WriteToClient(_c, sz_xvFormat, _d) - #define _WriteGrabPortReply(_c,_d) \ if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \ else WriteToClient(_c, sz_xvGrabPortReply, _d) @@ -239,7 +226,6 @@ ProcXvQueryExtension(ClientPtr client) static int ProcXvQueryAdaptors(ClientPtr client) { - xvFormat format; int totalSize, na, nf, rc; int nameSize; XvAdaptorPtr pa; @@ -318,14 +304,20 @@ ProcXvQueryAdaptors(ClientPtr client) nf = pa->nFormats; pf = pa->pFormats; while (nf--) { - format.depth = pf->depth; - format.visual = pf->visual; - _WriteFormat(client, &format); + xvFormat format = { + .depth = pf->depth, + .visual = pf->visual + }; + + if (client->swapped) + swapl(&format.visual); + + WriteToClient(client, sz_xvFormat, &format); + pf++; } pa++; - } return Success;