summaryrefslogtreecommitdiff
path: root/include/privates.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/privates.h')
-rw-r--r--include/privates.h80
1 files changed, 46 insertions, 34 deletions
diff --git a/include/privates.h b/include/privates.h
index 2b0040cba..c34b9512c 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -58,16 +58,16 @@ typedef enum {
} DevPrivateType;
typedef struct _DevPrivateKeyRec {
- int offset;
- int size;
- Bool initialized;
- Bool allocated;
- DevPrivateType type;
- struct _DevPrivateKeyRec *next;
+ int offset;
+ int size;
+ Bool initialized;
+ Bool allocated;
+ DevPrivateType type;
+ struct _DevPrivateKeyRec *next;
} DevPrivateKeyRec, *DevPrivateKey;
typedef struct _DevScreenPrivateKeyRec {
- DevPrivateKeyRec screenKey;
+ DevPrivateKeyRec screenKey;
} DevScreenPrivateKeyRec, *DevScreenPrivateKey;
/*
@@ -93,7 +93,7 @@ typedef struct _DevScreenPrivateKeyRec {
* during its operation.
*/
extern _X_EXPORT Bool
-dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size);
+ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size);
/*
* Check whether a private key has been registered
@@ -127,7 +127,7 @@ dixGetPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
static inline void *
dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
{
- assert (key->size == 0);
+ assert(key->size == 0);
return *(void **) dixGetPrivateAddr(privates, key);
}
@@ -138,7 +138,7 @@ dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
static inline void
dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val)
{
- assert (key->size == 0);
+ assert(key->size == 0);
*(pointer *) dixGetPrivateAddr(privates, key) = val;
}
@@ -156,9 +156,9 @@ static inline pointer
dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
{
if (key->size)
- return dixGetPrivateAddr(privates, key);
+ return dixGetPrivateAddr(privates, key);
else
- return dixGetPrivate(privates, key);
+ return dixGetPrivate(privates, key);
}
/*
@@ -170,44 +170,52 @@ dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
static inline pointer *
dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
{
- assert (key->size == 0);
- return (pointer *)dixGetPrivateAddr(privates, key);
+ assert(key->size == 0);
+ return (pointer *) dixGetPrivateAddr(privates, key);
}
extern _X_EXPORT Bool
-dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
+
+dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen,
+ DevPrivateType type, unsigned size);
extern _X_EXPORT DevPrivateKey
-_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
+ _dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
static inline void *
-dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void *
-dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void
-dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val)
+dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen, pointer val)
{
dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
}
static inline pointer
-dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline pointer *
-dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
+ ScreenPtr pScreen)
{
- return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
+ return dixLookupPrivateAddr(privates,
+ _dixGetScreenPrivateKey(key, pScreen));
}
/*
@@ -220,19 +228,19 @@ dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key,
* extensions entries.
*/
extern _X_EXPORT Bool
-dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type);
+ dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type);
/*
* Frees separately allocated private data
*/
extern _X_EXPORT void
-dixFreePrivates(PrivatePtr privates, DevPrivateType type);
+ dixFreePrivates(PrivatePtr privates, DevPrivateType type);
/*
* Initialize privates by zeroing them
*/
extern _X_EXPORT void
-_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
+ _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
#define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), type);
@@ -240,7 +248,7 @@ _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
* Clean up privates
*/
extern _X_EXPORT void
-_dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
+ _dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
#define dixFiniPrivates(o,t) _dixFiniPrivates((o)->devPrivates,t)
@@ -249,13 +257,17 @@ _dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
* for almost all objects, except for the list described
* above for dixAllocatePrivates.
*/
-extern _X_EXPORT void *
-_dixAllocateObjectWithPrivates(unsigned size, unsigned clear, unsigned offset, DevPrivateType type);
+extern _X_EXPORT void *_dixAllocateObjectWithPrivates(unsigned size,
+ unsigned clear,
+ unsigned offset,
+ DevPrivateType type);
#define dixAllocateObjectWithPrivates(t, type) (t *) _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, devPrivates), type)
extern _X_EXPORT void
-_dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType type);
+
+_dixFreeObjectWithPrivates(void *object, PrivatePtr privates,
+ DevPrivateType type);
#define dixFreeObjectWithPrivates(o,t) _dixFreeObjectWithPrivates(o, (o)->devPrivates, t)
@@ -263,20 +275,20 @@ _dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType typ
* Return size of privates for the specified type
*/
extern _X_EXPORT int
-dixPrivatesSize(DevPrivateType type);
+ dixPrivatesSize(DevPrivateType type);
/*
* Dump out private stats to ErrorF
*/
extern void
-dixPrivateUsage(void);
+ dixPrivateUsage(void);
/*
* Resets the privates subsystem. dixResetPrivates is called from the main loop
* before each server generation. This function must only be called by main().
*/
extern _X_EXPORT void
-dixResetPrivates(void);
+ dixResetPrivates(void);
/*
* Looks up the offset where the devPrivates field is located.
@@ -287,7 +299,7 @@ dixResetPrivates(void);
* structure definition.
*/
extern _X_EXPORT int
-dixLookupPrivateOffset(RESTYPE type);
+ dixLookupPrivateOffset(RESTYPE type);
/*
* Convenience macro for adding an offset to an object pointer
@@ -295,4 +307,4 @@ dixLookupPrivateOffset(RESTYPE type);
*/
#define DEVPRIV_AT(ptr, offset) ((PrivatePtr *)((char *)(ptr) + offset))
-#endif /* PRIVATES_H */
+#endif /* PRIVATES_H */