xcbint.h: use offsetof() from stddef.h instead of defining our own

C89 and later guarantee it will be defined in <stddef.h> and then
we don't have to worry about using undefined behavior to define it.

Closes: #83
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcb/-/merge_requests/76>
This commit is contained in:
Alan Coopersmith 2025-11-02 16:14:16 -08:00
parent d2153baa99
commit bfa06609c3

View file

@ -34,6 +34,8 @@
#include "config.h"
#endif
#include <stddef.h> /* for offsetof() definition */
#ifdef GCC_HAS_VISIBILITY
#pragma GCC visibility push(hidden)
#endif
@ -65,10 +67,6 @@ enum lazy_reply_tag
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
#ifndef offsetof
#define offsetof(type,member) ((size_t) &((type *)0)->member)
#endif
#ifndef MIN
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#endif