From d2e5ed2a89f4bac73f9191155d1e8487313e18f5 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 4 Dec 2025 17:11:44 +0100 Subject: [PATCH] Xi: drop SWAPIF macro Trivial enough for just writing the actual code. Signed-off-by: Enrico Weigelt, metux IT consult --- Xi/xichangehierarchy.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c index f8e1d581c7..75a310c8b3 100644 --- a/Xi/xichangehierarchy.c +++ b/Xi/xichangehierarchy.c @@ -424,8 +424,6 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo * c, int flags[MAXDEVICES]) return rc; } -#define SWAPIF(cmd) if (client->swapped) { cmd; } - int ProcXIChangeHierarchy(ClientPtr client) { @@ -454,8 +452,10 @@ ProcXIChangeHierarchy(ClientPtr client) goto unwind; } - SWAPIF(swaps(&any->type)); - SWAPIF(swaps(&any->length)); + if (client->swapped) { + swaps(&any->type); + swaps(&any->length); + } if (len < ((size_t)any->length << 2)) return BadLength; @@ -478,7 +478,10 @@ ProcXIChangeHierarchy(ClientPtr client) rc = BadLength; goto unwind; } - SWAPIF(swaps(&c->name_len)); + + if (client->swapped) + swaps(&c->name_len); + if (c->name_len > (len - sizeof(xXIAddMasterInfo))) { rc = BadLength; goto unwind;