diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index 1741285fe1..0ffa003783 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -57,6 +57,7 @@ SOFTWARE. #include "dix/dix_priv.h" #include "include/inputstr.h" /* DeviceIntPtr */ +#include "os/osdep.h" #include "Xi/handlers.h" #define DO_ALL (-1) diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c index 01f0e6e86c..d029735b75 100644 --- a/Xi/chgkmap.c +++ b/Xi/chgkmap.c @@ -57,6 +57,7 @@ SOFTWARE. #include "dix/dix_priv.h" #include "dix/exevents_priv.h" +#include "os/osdep.h" #include "Xi/handlers.h" #include "inputstr.h" /* DeviceIntPtr */ diff --git a/Xi/extinit.c b/Xi/extinit.c index 109695bf76..6428705c7c 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -65,6 +65,7 @@ SOFTWARE. #include "dix/exevents_priv.h" #include "dix/extension_priv.h" #include "miext/extinit_priv.h" +#include "os/osdep.h" #include "Xext/geext_priv.h" #include "inputstr.h" diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c index 48153eea18..62233f0b26 100644 --- a/Xi/grabdevb.c +++ b/Xi/grabdevb.c @@ -59,6 +59,7 @@ SOFTWARE. #include "dix/devices_priv.h" #include "dix/exevents_priv.h" #include "dix/input_priv.h" +#include "os/osdep.h" #include "Xi/handlers.h" #include "inputstr.h" /* DeviceIntPtr */ diff --git a/Xi/sendexev.c b/Xi/sendexev.c index 01456786ea..52cab4c3e1 100644 --- a/Xi/sendexev.c +++ b/Xi/sendexev.c @@ -58,6 +58,7 @@ SOFTWARE. #include "dix/dix_priv.h" #include "dix/exevents_priv.h" #include "dix/extension_priv.h" +#include "os/osdep.h" #include "Xi/handlers.h" #include "inputstr.h" /* DeviceIntPtr */ diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c index f8e1d581c7..7b1309183d 100644 --- a/Xi/xichangehierarchy.c +++ b/Xi/xichangehierarchy.c @@ -43,6 +43,7 @@ #include "dix/extension_priv.h" #include "dix/input_priv.h" #include "os/bug_priv.h" +#include "os/osdep.h" #include "Xi/handlers.h" #include "inputstr.h" /* DeviceIntPtr */ @@ -50,7 +51,6 @@ #include "scrnintstr.h" /* screen structure */ #include "extnsionst.h" #include "exglobals.h" -#include "misc.h" #include "xace.h" #include "xiquerydevice.h" /* for GetDeviceUse */ #include "xkbsrv.h" diff --git a/dix/enterleave.c b/dix/enterleave.c index a29a8e56cb..86b79767a9 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -40,6 +40,7 @@ #include "dix/window_priv.h" #include "include/extinit.h" #include "os/bug_priv.h" +#include "os/osdep.h" #include "inputstr.h" #include "windowstr.h" diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 7025521f81..e941c607da 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -42,6 +42,7 @@ #include "dix/exevents_priv.h" #include "dix/extension_priv.h" #include "dix/inpututils_priv.h" +#include "os/osdep.h" #include "dix.h" #include "inputstr.h" diff --git a/dix/inpututils.c b/dix/inpututils.c index c8dbd0d024..d2453f50f2 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -32,6 +32,7 @@ #include "dix/screenint_priv.h" #include "os/bug_priv.h" #include "os/mathx_priv.h" +#include "os/osdep.h" #include "exglobals.h" #include "inputstr.h" diff --git a/dix/request_priv.h b/dix/request_priv.h index 73ac303454..126ccef00f 100644 --- a/dix/request_priv.h +++ b/dix/request_priv.h @@ -12,6 +12,7 @@ #include "include/dixstruct.h" #include "include/misc.h" /* bytes_to_int32 */ #include "include/os.h" /* WriteToClient */ +#include "os/osdep.h" /* * @brief write rpc buffer to client and then clear it diff --git a/dix/rpcbuf.c b/dix/rpcbuf.c index f618f0e5ee..e9743a2847 100644 --- a/dix/rpcbuf.c +++ b/dix/rpcbuf.c @@ -8,6 +8,7 @@ #include "dix/dix_priv.h" #include "dix/rpcbuf_priv.h" +#include "os/osdep.h" static inline Bool __x_rpcbuf_write_bin_pad( x_rpcbuf_t *rpcbuf, const char *val, size_t len) diff --git a/dix/rpcbuf_priv.h b/dix/rpcbuf_priv.h index c4bb506154..76fac4b956 100644 --- a/dix/rpcbuf_priv.h +++ b/dix/rpcbuf_priv.h @@ -7,7 +7,6 @@ #include -#include "include/misc.h" #include "include/os.h" /* diff --git a/dix/swaprep.c b/dix/swaprep.c index 062e11271d..92aa919538 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -52,6 +52,7 @@ SOFTWARE. #include "dix/dix_priv.h" #include "dix/extension_priv.h" +#include "os/osdep.h" #include "misc.h" #include "dixstruct.h" diff --git a/exa/exa.c b/exa/exa.c index f9f67dc7ab..c838f656e3 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -34,6 +34,7 @@ #include "dix/screen_hooks_priv.h" #include "os/mathx_priv.h" +#include "os/osdep.h" #include "exa_priv.h" #include "exa.h" diff --git a/include/misc.h b/include/misc.h index 3c04594ebc..725fe9ff80 100644 --- a/include/misc.h +++ b/include/misc.h @@ -156,53 +156,6 @@ typedef int XRetCode; #endif -/** - * Calculate the number of bytes needed to hold bits. - * @param bits The minimum number of bits needed. - * @return The number of bytes needed to hold bits. - */ -static inline int -bits_to_bytes(const int bits) -{ - return ((bits + 7) >> 3); -} - -/** - * Calculate the number of 4-byte units needed to hold the given number of - * bytes. - * @param bytes The minimum number of bytes needed. - * @return The number of 4-byte units needed to hold bytes. - */ -static inline CARD32 -bytes_to_int32(const size_t bytes) -{ - return (CARD32)(((bytes) + 3) >> 2); -} - -/** - * Calculate the number of bytes (in multiples of 4) needed to hold bytes. - * @param bytes The minimum number of bytes needed. - * @return The closest multiple of 4 that is equal or higher than bytes. - */ -static inline int -pad_to_int32(const int bytes) -{ - return (((bytes) + 3) & ~3); -} - -/** - * Calculate padding needed to bring the number of bytes to an even - * multiple of 4. - * @param bytes The minimum number of bytes needed. - * @return The bytes of padding needed to arrive at the closest multiple of 4 - * that is equal or higher than bytes. - */ -static inline int -padding_for_int32(const int bytes) -{ - return ((-bytes) & 3); -} - /* some macros to help swap requests, replies, and events */ #define LengthRestS(stuff) \ diff --git a/os/osdep.h b/os/osdep.h index 2117d81eb9..8732ec1628 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -216,4 +216,48 @@ extern sig_atomic_t inSignalContext; /* run timers that are expired at timestamp `now` */ void DoTimers(CARD32 now); +/** + * Calculate padding needed to bring the number of bytes to an even + * multiple of 4. + * @param bytes The minimum number of bytes needed. + * @return The bytes of padding needed to arrive at the closest multiple of 4 + * that is equal or higher than bytes. + */ +static inline int padding_for_int32(const int bytes) +{ + return ((-bytes) & 3); +} + +/** + * Calculate the number of bytes (in multiples of 4) needed to hold bytes. + * @param bytes The minimum number of bytes needed. + * @return The closest multiple of 4 that is equal or higher than bytes. + */ +static inline int pad_to_int32(const int bytes) +{ + return (((bytes) + 3) & ~3); +} + +/** + * Calculate the number of 4-byte units needed to hold the given number of + * bytes. + * @param bytes The minimum number of bytes needed. + * @return The number of 4-byte units needed to hold bytes. + */ +static inline CARD32 bytes_to_int32(const size_t bytes) +{ + return (CARD32)(((bytes) + 3) >> 2); +} + +/** + * Calculate the number of bytes needed to hold bits. + * @param bits The minimum number of bits needed. + * @return The number of bytes needed to hold bits. + */ +static inline int +bits_to_bytes(const int bits) +{ + return ((bits + 7) >> 3); +} + #endif /* _OSDEP_H_ */ diff --git a/test/input.c b/test/input.c index d0a8560a63..0f082ebd54 100644 --- a/test/input.c +++ b/test/input.c @@ -40,6 +40,7 @@ #include "dix/inpututils_priv.h" #include "mi/mi_priv.h" #include "os/fmt.h" +#include "os/osdep.h" #include "misc.h" #include "resource.h" diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index 33729c855c..0da744962d 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -31,6 +31,7 @@ #include "dix/exevents_priv.h" #include "dix/eventconvert.h" #include "dix/inpututils_priv.h" +#include "os/osdep.h" #include "inputstr.h" #include "eventstr.h" diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c index 423caeb69e..5dad024597 100644 --- a/test/xi2/protocol-xipassivegrabdevice.c +++ b/test/xi2/protocol-xipassivegrabdevice.c @@ -35,6 +35,7 @@ #include #include "dix/exevents_priv.h" +#include "os/osdep.h" #include "Xi/handlers.h" #include "inputstr.h" diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c index 97a5440423..df9ee0549c 100644 --- a/test/xi2/protocol-xiquerydevice.c +++ b/test/xi2/protocol-xiquerydevice.c @@ -33,6 +33,7 @@ #include #include "miext/extinit_priv.h" +#include "os/osdep.h" #include "Xi/handlers.h" #include "inputstr.h"