include: misc.h: unexport various bit/byte counting inline functions

Those aren't used by any external drivers, so no need to keep
them in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-11-20 12:13:36 +01:00
parent f58fbda10f
commit 5511112ddf
20 changed files with 61 additions and 49 deletions

View File

@@ -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)

View File

@@ -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 */

View File

@@ -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"

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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)

View File

@@ -7,7 +7,6 @@
#include <stddef.h>
#include "include/misc.h"
#include "include/os.h"
/*

View File

@@ -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"

View File

@@ -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"

View File

@@ -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) \

View File

@@ -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_ */

View File

@@ -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"

View File

@@ -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"

View File

@@ -35,6 +35,7 @@
#include <X11/extensions/XI2proto.h>
#include "dix/exevents_priv.h"
#include "os/osdep.h"
#include "Xi/handlers.h"
#include "inputstr.h"

View File

@@ -33,6 +33,7 @@
#include <X11/Xatom.h>
#include "miext/extinit_priv.h"
#include "os/osdep.h"
#include "Xi/handlers.h"
#include "inputstr.h"