From a6b2eb3780dc0e5a188c4442efc5286b258bc64f Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 17 Feb 2025 17:48:20 +0100 Subject: [PATCH] misc.h: drop LengthRestB() macro Only used at exactly one place, for trivial size computation, so not worth having an extra macro in a public header for this. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- dix/swapreq.c | 2 +- doc/Xserver-spec.xml | 2 +- include/misc.h | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dix/swapreq.c b/dix/swapreq.c index 9031f083d..18bc75186 100644 --- a/dix/swapreq.c +++ b/dix/swapreq.c @@ -756,7 +756,7 @@ SProcStoreColors(ClientPtr client) REQUEST_AT_LEAST_SIZE(xStoreColorsReq); swapl(&stuff->cmap); pItem = (xColorItem *) &stuff[1]; - for (count = LengthRestB(stuff) / sizeof(xColorItem); --count >= 0;) + for (count = ((client->req_len << 2) - sizeof(xStoreColorsReq)) / sizeof(xColorItem); --count >= 0;) SwapColorItem(pItem++); return ((*ProcVector[X_StoreColors]) (client)); } diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml index 476be4322..0c5607448 100644 --- a/doc/Xserver-spec.xml +++ b/doc/Xserver-spec.xml @@ -600,7 +600,7 @@ are: REQUEST, REQUEST_SIZE_MATCH, REQUEST_AT_LEAST_SIZE, REQUEST_FIXED_SIZE, LEGAL_NEW_RESOURCE, and VALIDATE_DRAWABLE_AND_GC. Useful byte swapping macros can be found in Xserver/include/dix.h: WriteReplyToClient and WriteSwappedDataToClient; and -in Xserver/include/misc.h: bswap_64, bswap_32, bswap_16, LengthRestB, LengthRestS, +in Xserver/include/misc.h: bswap_64, bswap_32, bswap_16, LengthRestS, LengthRestL, SwapRestS, SwapRestL, swapl, swaps, cpswapl, and cpswaps. diff --git a/include/misc.h b/include/misc.h index 910dd6469..f65f5b436 100644 --- a/include/misc.h +++ b/include/misc.h @@ -250,9 +250,6 @@ version_compare(uint32_t a_major, uint32_t a_minor, /* some macros to help swap requests, replies, and events */ -#define LengthRestB(stuff) \ - ((client->req_len << 2) - sizeof(*stuff)) - #define LengthRestS(stuff) \ ((client->req_len << 1) - (sizeof(*stuff) >> 1))