devPrivates rework: move reset functions into a single call.

This commit is contained in:
Eamon Walsh 2007-03-07 09:57:02 -05:00 committed by Eamon Walsh
parent bb111291d8
commit aaef4d6a41
6 changed files with 27 additions and 31 deletions

View File

@ -359,15 +359,7 @@ main(int argc, char *argv[], char *envp[])
InitGlyphCaching(); InitGlyphCaching();
if (!dixResetPrivates()) if (!dixResetPrivates())
FatalError("couldn't init private data storage"); FatalError("couldn't init private data storage");
ResetExtensionPrivates();
ResetClientPrivates();
ResetScreenPrivates();
ResetWindowPrivates();
ResetGCPrivates();
ResetPixmapPrivates();
ResetColormapPrivates();
ResetFontPrivateIndex(); ResetFontPrivateIndex();
ResetDevicePrivateIndex();
InitCallbackManager(); InitCallbackManager();
InitVisualWrap(); InitVisualWrap();
InitOutput(&screenInfo, argc, argv); InitOutput(&screenInfo, argc, argv);

View File

@ -279,6 +279,15 @@ dixLookupPrivateOffset(RESTYPE type)
/* /*
* Called from the main loop to reset the subsystem. * Called from the main loop to reset the subsystem.
*/ */
static void ResetExtensionPrivates(void);
static void ResetClientPrivates(void);
static void ResetScreenPrivates(void);
static void ResetWindowPrivates(void);
static void ResetGCPrivates(void);
static void ResetPixmapPrivates(void);
static void ResetColormapPrivates(void);
static void ResetDevicePrivateIndex(void);
int int
dixResetPrivates(void) dixResetPrivates(void)
{ {
@ -297,6 +306,16 @@ dixResetPrivates(void)
if (!offsets) if (!offsets)
return FALSE; return FALSE;
/* reset legacy devPrivates support */
ResetExtensionPrivates();
ResetClientPrivates();
ResetScreenPrivates();
ResetWindowPrivates();
ResetGCPrivates();
ResetPixmapPrivates();
ResetColormapPrivates();
ResetDevicePrivateIndex();
/* register basic resource offsets */ /* register basic resource offsets */
if (!dixRegisterPrivateOffset(RT_WINDOW, offsetof(WindowRec,devPrivates))) if (!dixRegisterPrivateOffset(RT_WINDOW, offsetof(WindowRec,devPrivates)))
return FALSE; return FALSE;
@ -324,7 +343,7 @@ int extensionPrivateLen;
unsigned *extensionPrivateSizes; unsigned *extensionPrivateSizes;
unsigned totalExtensionSize; unsigned totalExtensionSize;
void static void
ResetExtensionPrivates() ResetExtensionPrivates()
{ {
extensionPrivateCount = 0; extensionPrivateCount = 0;
@ -381,7 +400,7 @@ int clientPrivateLen;
unsigned *clientPrivateSizes; unsigned *clientPrivateSizes;
unsigned totalClientSize; unsigned totalClientSize;
void static void
ResetClientPrivates() ResetClientPrivates()
{ {
clientPrivateCount = 0; clientPrivateCount = 0;
@ -435,7 +454,7 @@ AllocateClientPrivate(int index2, unsigned amount)
int screenPrivateCount; int screenPrivateCount;
void static void
ResetScreenPrivates() ResetScreenPrivates()
{ {
screenPrivateCount = 0; screenPrivateCount = 0;
@ -477,7 +496,7 @@ AllocateScreenPrivateIndex()
static int windowPrivateCount; static int windowPrivateCount;
void static void
ResetWindowPrivates() ResetWindowPrivates()
{ {
windowPrivateCount = 0; windowPrivateCount = 0;
@ -527,7 +546,7 @@ AllocateWindowPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
static int gcPrivateCount; static int gcPrivateCount;
void static void
ResetGCPrivates() ResetGCPrivates()
{ {
gcPrivateCount = 0; gcPrivateCount = 0;
@ -576,7 +595,7 @@ AllocateGCPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
*/ */
static int pixmapPrivateCount; static int pixmapPrivateCount;
void static void
ResetPixmapPrivates() ResetPixmapPrivates()
{ {
pixmapPrivateCount = 0; pixmapPrivateCount = 0;
@ -627,7 +646,7 @@ AllocatePixmapPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
int colormapPrivateCount; int colormapPrivateCount;
void static void
ResetColormapPrivates() ResetColormapPrivates()
{ {
colormapPrivateCount = 0; colormapPrivateCount = 0;
@ -712,7 +731,7 @@ AllocateDevicePrivate(DeviceIntPtr device, int index)
} }
} }
void static void
ResetDevicePrivateIndex(void) ResetDevicePrivateIndex(void)
{ {
devicePrivateIndex = 0; devicePrivateIndex = 0;

View File

@ -591,8 +591,6 @@ void
ScreenRestructured (ScreenPtr pScreen); ScreenRestructured (ScreenPtr pScreen);
#endif #endif
extern void ResetClientPrivates(void);
extern int AllocateClientPrivateIndex(void); extern int AllocateClientPrivateIndex(void);
extern Bool AllocateClientPrivate( extern Bool AllocateClientPrivate(

View File

@ -58,8 +58,6 @@ extern Bool EnableDisableExtension(char *name, Bool enable);
extern void EnableDisableExtensionError(char *name, Bool enable); extern void EnableDisableExtensionError(char *name, Bool enable);
extern void ResetExtensionPrivates(void);
extern int AllocateExtensionPrivateIndex(void); extern int AllocateExtensionPrivateIndex(void);
extern Bool AllocateExtensionPrivate( extern Bool AllocateExtensionPrivate(

View File

@ -160,7 +160,6 @@ typedef struct {
extern int AllocateDevicePrivateIndex(void); extern int AllocateDevicePrivateIndex(void);
extern Bool AllocateDevicePrivate(DeviceIntPtr device, int index); extern Bool AllocateDevicePrivate(DeviceIntPtr device, int index);
extern void ResetDevicePrivateIndex(void);
extern KeybdCtrl defaultKeyboardControl; extern KeybdCtrl defaultKeyboardControl;
extern PtrCtrl defaultPointerControl; extern PtrCtrl defaultPointerControl;

View File

@ -55,12 +55,8 @@ typedef struct _Visual *VisualPtr;
typedef struct _Depth *DepthPtr; typedef struct _Depth *DepthPtr;
typedef struct _Screen *ScreenPtr; typedef struct _Screen *ScreenPtr;
extern void ResetScreenPrivates(void);
extern int AllocateScreenPrivateIndex(void); extern int AllocateScreenPrivateIndex(void);
extern void ResetWindowPrivates(void);
extern int AllocateWindowPrivateIndex(void); extern int AllocateWindowPrivateIndex(void);
extern Bool AllocateWindowPrivate( extern Bool AllocateWindowPrivate(
@ -68,8 +64,6 @@ extern Bool AllocateWindowPrivate(
int /* index */, int /* index */,
unsigned /* amount */); unsigned /* amount */);
extern void ResetGCPrivates(void);
extern int AllocateGCPrivateIndex(void); extern int AllocateGCPrivateIndex(void);
extern Bool AllocateGCPrivate( extern Bool AllocateGCPrivate(
@ -86,8 +80,6 @@ extern int AddScreen(
int /*argc*/, int /*argc*/,
char** /*argv*/); char** /*argv*/);
extern void ResetPixmapPrivates(void);
extern int AllocatePixmapPrivateIndex(void); extern int AllocatePixmapPrivateIndex(void);
extern Bool AllocatePixmapPrivate( extern Bool AllocatePixmapPrivate(
@ -95,8 +87,6 @@ extern Bool AllocatePixmapPrivate(
int /* index */, int /* index */,
unsigned /* amount */); unsigned /* amount */);
extern void ResetColormapPrivates(void);
typedef struct _ColormapRec *ColormapPtr; typedef struct _ColormapRec *ColormapPtr;
typedef int (*InitCmapPrivFunc)(ColormapPtr, int); typedef int (*InitCmapPrivFunc)(ColormapPtr, int);