From 2e0024a2b75f5786699ed435163cac4403ca2625 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 22 Aug 2025 15:38:43 +0200 Subject: [PATCH] compext: simplify ProcCompositeQueryVersion() a little bit Since we're already statically initializing the reply header anyways, use the default case values here and overwrite them only when requested version is lower than server's one. That code path is so cold (at max only called once per client), we really don't need to care whether there's any chance for saving a few cycles. So not trying to be clever, but instead focus on readability. Signed-off-by: Enrico Weigelt, metux IT consult --- composite/compext.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/composite/compext.c b/composite/compext.c index aae76bcbf6..4fd158204c 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -104,16 +104,17 @@ ProcCompositeQueryVersion(ClientPtr client) CompositeClientPtr pCompositeClient = GetCompositeClient(client); - xCompositeQueryVersionReply rep = { 0 }; + xCompositeQueryVersionReply rep = { + .majorVersion = SERVER_COMPOSITE_MAJOR_VERSION, + .minorVersion = SERVER_COMPOSITE_MINOR_VERSION + }; + /* if client asking for a lower version, use this one */ if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } - else { - rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION; - rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION; - } + pCompositeClient->major_version = rep.majorVersion; pCompositeClient->minor_version = rep.minorVersion; if (client->swapped) {