From 8a2dfa1aba838e614b1c9a6bc787bd1f015e7129 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 14 Aug 2025 16:40:42 +0200 Subject: [PATCH] dix: macro for computing extra units needed for reply header Add macro X_REPLY_HEADER_UNITS() for computing how many extra protocol units are needed for a reply header (for .length field) Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dix_priv.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index 745449d164..a8756166bf 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -739,4 +739,13 @@ static inline Atom dixGetAtomID(const char *name) { return MakeAtom(name, (unsigned int)strlen(name), FALSE); } +/* compute the amount of extra units a reply header needs. + * + * all reply header structs are at least the size of xGenericReply + * we have to count how many units the header is bigger than xGenericReply + * + */ +#define X_REPLY_HEADER_UNITS(hdrtype) \ + (pad_to_int32((sizeof(hdrtype) - sizeof(xGenericReply)))) + #endif /* _XSERVER_DIX_PRIV_H */