dix: macro for checking X protocol types

The X protocol types from xorgproto all have corresponding sz_<typename>
defines with their actual network payload size (this can be checked via
SIZEOF() macro).

In theory, this should always be the same as sizeof(), but just to be sure,
adding a macro for a static assert on that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-14 23:46:52 +02:00
parent 96b0e59066
commit 8e84c35431

View File

@@ -38,6 +38,13 @@
} \
} while (0)
/* static assert for protocol structure sizes */
#ifndef __size_assert
#define __size_assert(what, howmuch) \
typedef char what##_size_wrong_[( !!(sizeof(what) == howmuch) )*2-1 ]
#endif
#define XTYPE_SIZE_ASSERT(typename) __size_assert(typename,SIZEOF(typename))
/* server setting: maximum size for big requests */
#define MAX_BIG_REQUEST_SIZE 4194303
extern long maxBigRequestSize;