[PATCH] Convert all calls of CreateNewResourceType to CreateNewResourceTypeNamed

Alan Coopersmith alan.coopersmith at sun.com
Thu Feb 12 19:36:07 PST 2009


Also cleaned up various bits of checking to see if CreateNewResourceType
failed, including several places where the result was |'ed with flag bits
before checking to see if it was 0.

Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
 Xext/geext.c                          |    4 ++--
 Xext/mbuf.c                           |   13 +++++++++----
 Xext/panoramiX.c                      |   20 +++++++++++++-------
 Xext/saver.c                          |    8 +++++---
 Xext/security.c                       |   10 +++++-----
 Xext/shape.c                          |    4 ++--
 Xext/shm.c                            |    2 +-
 Xext/sleepuntil.c                     |    3 ++-
 Xext/sync.c                           |   13 ++++++++-----
 Xext/xvdisp.c                         |    2 +-
 Xext/xvmain.c                         |   25 +++++++++++++++----------
 Xext/xvmc.c                           |    9 ++++++---
 Xi/extinit.c                          |    6 ++++--
 composite/compext.c                   |    9 ++++++---
 damageext/damageext.c                 |    5 +++--
 dbe/dbe.c                             |    8 ++++++--
 glx/glxext.c                          |   11 ++++++++---
 hw/dmx/glxProxy/glxext.c              |   15 ++++++++++-----
 hw/kdrive/ephyr/ephyrdriext.c         |    2 +-
 hw/xfree86/dixmods/extmod/xf86vmode.c |    3 ++-
 hw/xfree86/dri/dri.c                  |    9 +++++++--
 hw/xfree86/dri/xf86dri.c              |    2 +-
 hw/xfree86/dri2/dri2ext.c             |    7 ++++++-
 hw/xquartz/applewm.c                  |    4 ++--
 hw/xquartz/xpr/dri.c                  |    5 +++--
 hw/xwin/winwindowswm.c                |    4 ++--
 mi/miarc.c                            |    3 ++-
 randr/randr.c                         |    4 ++--
 randr/rrcrtc.c                        |    4 +---
 randr/rrmode.c                        |    4 +---
 randr/rroutput.c                      |    5 ++---
 record/record.c                       |    3 ++-
 render/picture.c                      |   11 ++++-------
 render/render.c                       |    3 ++-
 xfixes/cursor.c                       |    9 ++++++---
 xfixes/region.c                       |    2 +-
 xfixes/select.c                       |    6 ++++--
 xkb/xkb.c                             |    2 +-
 38 files changed, 158 insertions(+), 101 deletions(-)

diff --git a/Xext/geext.c b/Xext/geext.c
index a58db03..1f34672 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -277,8 +277,8 @@ GEExtensionInit(void)
         GEErrorBase = extEntry->errorBase;
         GEEventType = GEEventBase;
 
-        RT_GECLIENT = CreateNewResourceType((DeleteType)GEClientGone);
-        RegisterResourceName(RT_GECLIENT, "GECLIENT");
+        RT_GECLIENT = CreateNewResourceTypeNamed((DeleteType)GEClientGone,
+						 "GECLIENT");
 
         memset(GEExtensions, 0, sizeof(GEExtensions));
 
diff --git a/Xext/mbuf.c b/Xext/mbuf.c
index 09399b6..dffe978 100644
--- a/Xext/mbuf.c
+++ b/Xext/mbuf.c
@@ -221,10 +221,14 @@ MultibufferExtensionInit()
      * create the resource types
      */
     MultibufferDrawableResType =
-	CreateNewResourceType(MultibufferDrawableDelete)|RC_DRAWABLE;
-    MultibufferResType = CreateNewResourceType(MultibufferDelete);
-    MultibuffersResType = CreateNewResourceType(MultibuffersDelete);
-    OtherClientResType = CreateNewResourceType(OtherClientDelete);
+	CreateNewResourceTypeNamed(MultibufferDrawableDelete,
+				   "MultibufferDrawable");
+    MultibufferResType = CreateNewResourceTypeNamed(MultibufferDelete,
+						    "MultibufferBuffer");
+    MultibuffersResType = CreateNewResourceTypeNamed(MultibuffersDelete,
+						     "MultibufferWindow");
+    OtherClientResType = CreateNewResourceTypeNamed(OtherClientDelete,
+						    "MultibufferOtherClient");
     if (MultibufferDrawableResType && MultibufferResType &&
 	MultibuffersResType && 	OtherClientResType &&
 	(extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME,
@@ -233,6 +237,7 @@ MultibufferExtensionInit()
 				 ProcMultibufferDispatch, SProcMultibufferDispatch,
 				 MultibufferResetProc, StandardMinorOpcode)))
     {
+	MultibufferDrawableResType |= RC_DRAWABLE;
 	MultibufferEventBase = extEntry->eventBase;
 	MultibufferErrorBase = extEntry->errorBase;
 	EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 0439668..f09227b 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -500,15 +500,21 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 	}
 
 	XRC_DRAWABLE = CreateNewResourceClass();
-	XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) | 
-						XRC_DRAWABLE;
-	XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) | 
-						XRC_DRAWABLE;
-	XRT_GC = CreateNewResourceType(XineramaDeleteResource);
-	XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource);
+	XRT_WINDOW = CreateNewResourceTypeNamed(XineramaDeleteResource,
+						"XineramaWindow");
+	XRT_PIXMAP = CreateNewResourceTypeNamed(XineramaDeleteResource,
+						"XineramaPixmap");
+	XRT_GC = CreateNewResourceTypeNamed(XineramaDeleteResource,
+					    "XineramaGC");
+	XRT_COLORMAP = CreateNewResourceTypeNamed(XineramaDeleteResource,
+						  "XineramaColormap");
 
 	panoramiXGeneration = serverGeneration;
-	success = TRUE;
+	if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) {
+	    XRT_WINDOW |= XRC_DRAWABLE;
+	    XRT_PIXMAP |= XRC_DRAWABLE;
+	    success = TRUE;
+	}
     }
 
     if (!success) {
diff --git a/Xext/saver.c b/Xext/saver.c
index cd67749..f1b0f33 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -252,9 +252,11 @@ ScreenSaverExtensionInit(INITARGS)
     int		    i;
     ScreenPtr	    pScreen;
 
-    AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
-    SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents);
-    SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend);
+    AttrType = CreateNewResourceTypeNamed(ScreenSaverFreeAttr, "SaverAttr");
+    SaverEventType = CreateNewResourceTypeNamed(ScreenSaverFreeEvents,
+						"SaverEvent");
+    SuspendType = CreateNewResourceTypeNamed(ScreenSaverFreeSuspend,
+					     "SaverSuspend");
 
     for (i = 0; i < screenInfo.numScreens; i++)
     {
diff --git a/Xext/security.c b/Xext/security.c
index fc4691b..0c28ec0 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -1093,17 +1093,17 @@ SecurityExtensionInit(INITARGS)
     int ret = TRUE;
 
     SecurityAuthorizationResType =
-	CreateNewResourceType(SecurityDeleteAuthorization);
+	CreateNewResourceTypeNamed(SecurityDeleteAuthorization,
+				   "SecurityAuthorization");
 
-    RTEventClient = CreateNewResourceType(
-				SecurityDeleteAuthorizationEventClient);
+    RTEventClient = CreateNewResourceTypeNamed(
+				SecurityDeleteAuthorizationEventClient,
+				"SecurityEventClient");
 
     if (!SecurityAuthorizationResType || !RTEventClient)
 	return;
 
     RTEventClient |= RC_NEVERRETAIN;
-    RegisterResourceName(SecurityAuthorizationResType, "SecurityAuthorization");
-    RegisterResourceName(RTEventClient, "SecurityEventClient");
 
     /* Allocate the private storage */
     if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec)))
diff --git a/Xext/shape.c b/Xext/shape.c
index fbf8f8c..d1991ff 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -127,8 +127,8 @@ ShapeExtensionInit(void)
 {
     ExtensionEntry *extEntry;
 
-    ClientType = CreateNewResourceType(ShapeFreeClient);
-    ShapeEventType = CreateNewResourceType(ShapeFreeEvents);
+    ClientType = CreateNewResourceTypeNamed(ShapeFreeClient, "ShapeClient");
+    ShapeEventType = CreateNewResourceTypeNamed(ShapeFreeEvents, "ShapeEvent");
     if (ClientType && ShapeEventType &&
 	(extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
 				 ProcShapeDispatch, SProcShapeDispatch,
diff --git a/Xext/shm.c b/Xext/shm.c
index 7b63484..b2406e7 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -244,7 +244,7 @@ ShmExtensionInit(INITARGS)
 	    screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
 	}
     }
-    ShmSegType = CreateNewResourceType(ShmDetachSegment);
+    ShmSegType = CreateNewResourceTypeNamed(ShmDetachSegment, "ShmSeg");
     if (ShmSegType &&
 	(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
 				 ProcShmDispatch, SProcShmDispatch,
diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 2616a5e..84a260f 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -87,7 +87,8 @@ ClientSleepUntil (ClientPtr client,
 
     if (SertafiedGeneration != serverGeneration)
     {
-	SertafiedResType = CreateNewResourceType (SertafiedDelete);
+	SertafiedResType = CreateNewResourceTypeNamed (SertafiedDelete,
+						       "ClientSleep");
 	if (!SertafiedResType)
 	    return FALSE;
 	SertafiedGeneration = serverGeneration;
diff --git a/Xext/sync.c b/Xext/sync.c
index 9236fab..5d2d77c 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -876,7 +876,7 @@ SyncCreateSystemCounter(
      */
     if (RTCounter == 0)
     {
-	RTCounter = CreateNewResourceType(FreeCounter);
+	RTCounter = CreateNewResourceTypeNamed(FreeCounter, "SyncCounter");
 	if (RTCounter == 0)
 	{
 	    return NULL;
@@ -2127,11 +2127,12 @@ SyncExtensionInit(void)
 
     if (RTCounter == 0)
     {
-	RTCounter = CreateNewResourceType(FreeCounter);
+	RTCounter = CreateNewResourceTypeNamed(FreeCounter, "SyncCounter");
     }
-    RTAlarm = CreateNewResourceType(FreeAlarm);
-    RTAwait = CreateNewResourceType(FreeAwait)|RC_NEVERRETAIN;
-    RTAlarmClient = CreateNewResourceType(FreeAlarmClient)|RC_NEVERRETAIN;
+    RTAlarm = CreateNewResourceTypeNamed(FreeAlarm, "SyncAlarm");
+    RTAwait = CreateNewResourceTypeNamed(FreeAwait, "SyncAwait");
+    RTAlarmClient = CreateNewResourceTypeNamed(FreeAlarmClient,
+					       "SyncAlarmClient");
 
     if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 ||
 	RTAlarmClient == 0 ||
@@ -2146,6 +2147,8 @@ SyncExtensionInit(void)
 	return;
     }
 
+    RTAwait |= RC_NEVERRETAIN;
+    RTAlarmClient |= RC_NEVERRETAIN;
     SyncEventBase = extEntry->eventBase;
     SyncErrorBase = extEntry->errorBase;
     EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 770c53a..bc8039d 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1924,7 +1924,7 @@ void XineramifyXv(void)
    XvAdaptorPtr MatchingAdaptors[MAXSCREENS];
    int i, j, k, l;
 
-   XvXRTPort = CreateNewResourceType(XineramaDeleteResource);
+   XvXRTPort = CreateNewResourceTypeNamed(XineramaDeleteResource, "XvXRTPort");
 
    if(!xvsp0) return;
    
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 4771946..92fba4f 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -208,37 +208,42 @@ CreateResourceTypes(void)
 
   XvResourceGeneration = serverGeneration;
 
-  if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort)))
+  if (!(XvRTPort = CreateNewResourceTypeNamed(XvdiDestroyPort, "XvRTPort")))
     {
       ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
       return FALSE;
     }
-  
-  if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab)))
+
+  if (!(XvRTGrab = CreateNewResourceTypeNamed(XvdiDestroyGrab, "XvRTGrab")))
     {
       ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
       return FALSE;
     }
-  
-  if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding)))
+
+  if (!(XvRTEncoding = CreateNewResourceTypeNamed(XvdiDestroyEncoding,
+						  "XvRTEncoding")))
     {
       ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
       return FALSE;
     }
-  
-  if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify)))
+
+  if (!(XvRTVideoNotify = CreateNewResourceTypeNamed(XvdiDestroyVideoNotify,
+						     "XvRTVideoNotify")))
     {
       ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
       return FALSE;
     }
-  
-  if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList)))
+
+  if (!(XvRTVideoNotifyList =
+	CreateNewResourceTypeNamed(XvdiDestroyVideoNotifyList,
+				   "XvRTVideoNotifyList")))
     {
       ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
       return FALSE;
     }
 
-  if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify)))
+  if (!(XvRTPortNotify = CreateNewResourceTypeNamed(XvdiDestroyPortNotify,
+						    "XvRTPortNotify")))
     {
       ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
       return FALSE;
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index 9166cf8..6eeaec0 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -670,13 +670,16 @@ XvMCExtensionInit(void)
    if(XvMCScreenKey == NULL) /* nobody supports it */
 	return; 
 
-   if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes)))
+   if(!(XvMCRTContext = CreateNewResourceTypeNamed(XvMCDestroyContextRes,
+						   "XvMCRTContext")))
 	return;
 
-   if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes)))
+   if(!(XvMCRTSurface = CreateNewResourceTypeNamed(XvMCDestroySurfaceRes,
+						   "XvMCRTSurface")))
 	return;
 
-   if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes)))
+   if(!(XvMCRTSubpicture = CreateNewResourceTypeNamed(XvMCDestroySubpictureRes,
+						      "XvMCRTSubpicture")))
 	return;
 
    extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors, 
diff --git a/Xi/extinit.c b/Xi/extinit.c
index a7a21ec..ffc4299 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1143,8 +1143,10 @@ XInputExtensionInit(void)
 	IEventBase = extEntry->eventBase;
 	AllExtensionVersions[IReqCode - 128] = thisversion;
 	MakeDeviceTypeAtoms();
-	RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
-	RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT");
+	RT_INPUTCLIENT = CreateNewResourceTypeNamed(
+	    (DeleteType) InputClientGone, "INPUTCLIENT");
+	if (!RT_INPUTCLIENT)
+	    FatalError("Failed to add resource type for XI.\n");
 	FixExtensionEvents(extEntry);
 	ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
 	EventSwapVector[DeviceValuator] = SEventIDispatch;
diff --git a/composite/compext.c b/composite/compext.c
index c154402..6fedc49 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -574,15 +574,18 @@ CompositeExtensionInit (void)
 	return;
 #endif
 
-    CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
+    CompositeClientWindowType = CreateNewResourceTypeNamed
+	(FreeCompositeClientWindow, "CompositeClientWindow");
     if (!CompositeClientWindowType)
 	return;
 
-    CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows);
+    CompositeClientSubwindowsType = CreateNewResourceTypeNamed
+	(FreeCompositeClientSubwindows, "CompositeClientSubwindows");
     if (!CompositeClientSubwindowsType)
 	return;
 
-    CompositeClientOverlayType = CreateNewResourceType (FreeCompositeClientOverlay);
+    CompositeClientOverlayType = CreateNewResourceTypeNamed
+	(FreeCompositeClientOverlay, "CompositeClientOverlay");
     if (!CompositeClientOverlayType)
 	return;
 
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 8fa1c53..26a7cb9 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -503,11 +503,12 @@ DamageExtensionInit(void)
     for (s = 0; s < screenInfo.numScreens; s++)
 	DamageSetup (screenInfo.screens[s]);
 
-    DamageExtType = CreateNewResourceType (FreeDamageExt);
+    DamageExtType = CreateNewResourceTypeNamed (FreeDamageExt, "DamageExt");
     if (!DamageExtType)
 	return;
 
-    DamageExtWinType = CreateNewResourceType (FreeDamageExtWin);
+    DamageExtWinType = CreateNewResourceTypeNamed (FreeDamageExtWin,
+						   "DamageExtWin");
     if (!DamageExtWinType)
 	return;
 
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 3fd99df..11383a5 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -1568,9 +1568,13 @@ DbeExtensionInit(void)
 
     /* Create the resource types. */
     dbeDrawableResType =
-        CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
+        CreateNewResourceTypeNamed(DbeDrawableDelete, "dbeDrawable");
     dbeWindowPrivResType =
-        CreateNewResourceType(DbeWindowPrivDelete);
+        CreateNewResourceTypeNamed(DbeWindowPrivDelete, "dbeWindow");
+    if (!dbeDrawableResType || !dbeWindowPrivResType)
+	return;
+    dbeDrawableResType |= RC_DRAWABLE;
+
     if (!dixRegisterPrivateOffset(dbeDrawableResType,
 				  offsetof(PixmapRec, devPrivates)))
 	return;
diff --git a/glx/glxext.c b/glx/glxext.c
index 025e619..f5083de 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -291,9 +291,14 @@ void GlxExtensionInit(void)
     __GLXprovider *p;
     Bool glx_provided = False;
 
-    __glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
-    __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
-    __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone);
+    __glXContextRes = CreateNewResourceTypeNamed((DeleteType)ContextGone,
+						 "GLXContext");
+    __glXDrawableRes = CreateNewResourceTypeNamed((DeleteType)DrawableGone,
+						  "GLXDrawable");
+    __glXSwapBarrierRes = CreateNewResourceTypeNamed(
+	(DeleteType)SwapBarrierGone, "GLXSwapBarrier");
+    if (!__glXContextRes || !__glXDrawableRes || !__glXSwapBarrierRes)
+	return;
 
     if (!dixRequestPrivate(glxClientPrivateKey, sizeof (__GLXclientState)))
 	return;
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index b30d144..74ae8f0 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -293,11 +293,16 @@ void GlxExtensionInit(void)
        return;
     }
     
-    __glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
-    __glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
-    __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
-    __glXWindowRes = CreateNewResourceType((DeleteType)WindowGone);
-    __glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone);
+    __glXContextRes = CreateNewResourceTypeNamed((DeleteType)ContextGone,
+						 "GLXContext");
+    __glXClientRes = CreateNewResourceTypeNamed((DeleteType)ClientGone,
+					   "GLXClient");
+    __glXPixmapRes = CreateNewResourceTypeNamed((DeleteType)PixmapGone,
+						"GLXPixmap");
+    __glXWindowRes = CreateNewResourceTypeNamed((DeleteType)WindowGone,
+						"GLXWindow");
+    __glXPbufferRes = CreateNewResourceTypeNamed((DeleteType)PbufferGone,
+						 "GLXPbuffer");
 
     /*
     ** Add extension to server extensions.
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index a127aef..14cd8a6 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -140,7 +140,7 @@ ephyrDRIExtensionInit (ScreenPtr a_screen)
     EPHYR_LOG ("host X does have XShape extension\n") ;
 
 #ifdef XF86DRI_EVENTS
-    EventType = CreateNewResourceType (XF86DRIFreeEvents);
+    EventType = CreateNewResourceTypeNamed (XF86DRIFreeEvents, "DRIEvents");
 #endif
 
     if ((extEntry = AddExtension(XF86DRINAME,
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index ea8089e..78957e4 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -170,7 +170,8 @@ XFree86VidModeExtensionInit(void)
     DEBUG_P("XFree86VidModeExtensionInit");
 
 #ifdef XF86VIDMODE_EVENTS
-    EventType = CreateNewResourceType(XF86VidModeFreeEvents);
+    EventType = CreateNewResourceTypeNamed(XF86VidModeFreeEvents,
+					   "VidModeEvent");
 #endif
 
     for(i = 0; i < screenInfo.numScreens; i++) {
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 871b6a9..a4bfaae 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -790,8 +790,13 @@ DRIExtensionInit(void)
 	return FALSE;
     }
 
-    DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
-    DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
+    DRIDrawablePrivResType = CreateNewResourceTypeNamed(DRIDrawablePrivDelete,
+							"DRIDrawable");
+    DRIContextPrivResType = CreateNewResourceTypeNamed(DRIContextPrivDelete,
+						       "DRIContext");
+
+    if (!DRIDrawablePrivResType || !DRIContextPrivResType)
+	return FALSE;
 
     RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
 
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 902fe12..e7c0f43 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -93,7 +93,7 @@ XFree86DRIExtensionInit(void)
     ExtensionEntry* extEntry;
 
 #ifdef XF86DRI_EVENTS
-    EventType = CreateNewResourceType(XF86DRIFreeEvents);
+    EventType = CreateNewResourceTypeNamed(XF86DRIFreeEvents, "DRIEvent");
 #endif
 
     if (
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index d6e1c96..0a74bd0 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -352,6 +352,12 @@ static int DRI2DrawableGone(pointer p, XID id)
 static void
 DRI2ExtensionInit(void)
 {
+    dri2DrawableRes = CreateNewResourceTypeNamed(DRI2DrawableGone,
+						 "DRI2Drawable");
+
+    if (!dri2DrawableRes)
+	return;
+
     dri2Extension = AddExtension(DRI2_NAME,
 				 DRI2NumberEvents,
 				 DRI2NumberErrors,
@@ -360,7 +366,6 @@ DRI2ExtensionInit(void)
 				 NULL,
 				 StandardMinorOpcode);
 
-    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
 }
 
 extern Bool noDRI2Extension;
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 238b90d..4b7e207 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -110,8 +110,8 @@ AppleWMExtensionInit(
 {
     ExtensionEntry* extEntry;
 
-    ClientType = CreateNewResourceType(WMFreeClient);
-    EventType = CreateNewResourceType(WMFreeEvents);
+    ClientType = CreateNewResourceTypeNamed(WMFreeClient, "WMClient");
+    EventType = CreateNewResourceTypeNamed(WMFreeEvents, "WMEvent");
     eventResource = FakeClientID(0);
 
     if (ClientType && EventType &&
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 59a4fdd..281333a 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -256,9 +256,10 @@ DRICloseScreen(ScreenPtr pScreen)
 Bool
 DRIExtensionInit(void)
 {
-    DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
+    DRIDrawablePrivResType = CreateNewResourceTypeNamed(DRIDrawablePrivDelete,
+							"DRIDrawable");
 
-    return TRUE;
+    return (DRIDrawablePrivResType != 0);
 }
 
 void
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 2eecd6b..e7efaba 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -84,8 +84,8 @@ winWindowsWMExtensionInit ()
 {
   ExtensionEntry* extEntry;
 
-  ClientType = CreateNewResourceType(WMFreeClient);
-  EventType = CreateNewResourceType(WMFreeEvents);
+  ClientType = CreateNewResourceTypeNamed(WMFreeClient, "WMClient");
+  EventType = CreateNewResourceTypeNamed(WMFreeEvents, "WMEvent");
   eventResource = FakeClientID(0);
 
   if (ClientType && EventType &&
diff --git a/mi/miarc.c b/mi/miarc.c
index a3e2580..545b3ba 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -866,7 +866,8 @@ miComputeWideEllipse(
 	}
 	if (!cacheType)
 	{
-	    cacheType = CreateNewResourceType(miFreeArcCache);
+	    cacheType = CreateNewResourceTypeNamed(miFreeArcCache,
+						   "miArcCache");
 	    (void) AddResource(FakeClientID(0), cacheType, NULL);
 	}
     } else {
diff --git a/randr/randr.c b/randr/randr.c
index 07dd9e9..ac8cba0 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -326,10 +326,10 @@ RRExtensionInit (void)
     if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
 	return;
 
-    RRClientType = CreateNewResourceType(RRFreeClient);
+    RRClientType = CreateNewResourceTypeNamed(RRFreeClient, "RandRClient");
     if (!RRClientType)
 	return;
-    RREventType = CreateNewResourceType(RRFreeEvents);
+    RREventType = CreateNewResourceTypeNamed(RRFreeEvents, "RandREvent");
     if (!RREventType)
 	return;
     extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 2160834..cea7775 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -22,7 +22,6 @@
 
 #include "randrstr.h"
 #include "swaprep.h"
-#include "registry.h"
 
 RESTYPE	RRCrtcType;
 
@@ -633,10 +632,9 @@ RRCrtcTransformSet (RRCrtcPtr		crtc,
 Bool
 RRCrtcInit (void)
 {
-    RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource);
+    RRCrtcType = CreateNewResourceTypeNamed (RRCrtcDestroyResource, "CRTC");
     if (!RRCrtcType)
 	return FALSE;
-    RegisterResourceName (RRCrtcType, "CRTC");
     return TRUE;
 }
 
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 2fa4403..f23d8ad 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -21,7 +21,6 @@
  */
 
 #include "randrstr.h"
-#include "registry.h"
 
 RESTYPE	RRModeType;
 
@@ -266,10 +265,9 @@ RRModeInit (void)
 {
     assert (num_modes == 0);
     assert (modes == NULL);
-    RRModeType = CreateNewResourceType (RRModeDestroyResource);
+    RRModeType = CreateNewResourceTypeNamed (RRModeDestroyResource, "MODE");
     if (!RRModeType)
 	return FALSE;
-    RegisterResourceName (RRModeType, "MODE");
     return TRUE;
 }
 
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 0ae7873..3ee3865 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -22,7 +22,6 @@
  */
 
 #include "randrstr.h"
-#include "registry.h"
 
 RESTYPE	RROutputType;
 
@@ -422,10 +421,10 @@ RROutputDestroyResource (pointer value, XID pid)
 Bool
 RROutputInit (void)
 {
-    RROutputType = CreateNewResourceType (RROutputDestroyResource);
+    RROutputType = CreateNewResourceTypeNamed (RROutputDestroyResource,
+					       "OUTPUT");
     if (!RROutputType)
 	return FALSE;
-    RegisterResourceName (RROutputType, "OUTPUT");
     return TRUE;
 }
 
diff --git a/record/record.c b/record/record.c
index f97626f..5a77343 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2863,7 +2863,8 @@ RecordExtensionInit(void)
 {
     ExtensionEntry *extentry;
 
-    RTContext = CreateNewResourceType(RecordDeleteContext);
+    RTContext = CreateNewResourceTypeNamed(RecordDeleteContext,
+					   "RecordContext");
     if (!RTContext)
 	return;
 
diff --git a/render/picture.c b/render/picture.c
index f99c53f..4984535 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -41,7 +41,6 @@
 #include "servermd.h"
 #include "picturestr.h"
 #include "xace.h"
-#include "registry.h"
 
 static int PictureScreenPrivateKeyIndex;
 DevPrivateKey PictureScreenPrivateKey = &PictureScreenPrivateKeyIndex;
@@ -577,19 +576,17 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     
     if (PictureGeneration != serverGeneration)
     {
-	PictureType = CreateNewResourceType (FreePicture);
+	PictureType = CreateNewResourceTypeNamed (FreePicture, "PICTURE");
 	if (!PictureType)
 	    return FALSE;
-	PictFormatType = CreateNewResourceType (FreePictFormat);
+	PictFormatType = CreateNewResourceTypeNamed (FreePictFormat,
+						     "PICTFORMAT");
 	if (!PictFormatType)
 	    return FALSE;
-	GlyphSetType = CreateNewResourceType (FreeGlyphSet);
+	GlyphSetType = CreateNewResourceTypeNamed (FreeGlyphSet, "GLYPHSET");
 	if (!GlyphSetType)
 	    return FALSE;
 	PictureGeneration = serverGeneration;
-	RegisterResourceName (PictureType, "PICTURE");
-	RegisterResourceName (PictFormatType, "PICTFORMAT");
-	RegisterResourceName (GlyphSetType, "GLYPHSET");
     }
     if (!formats)
     {
diff --git a/render/render.c b/render/render.c
index 658b170..01e0acc 100644
--- a/render/render.c
+++ b/render/render.c
@@ -3268,7 +3268,8 @@ PanoramiXRenderInit (void)
 {
     int	    i;
     
-    XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource);
+    XRT_PICTURE = CreateNewResourceTypeNamed (XineramaDeleteResource,
+					      "XineramaPicture");
     for (i = 0; i < RenderNumberRequests; i++)
 	PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
     /*
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index cd3df12..80038de 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1062,9 +1062,12 @@ XFixesCursorInit (void)
 	cs->pCursorHideCounts = NULL;
 	SetCursorScreen (pScreen, cs);
     }
-    CursorClientType = CreateNewResourceType(CursorFreeClient);
-    CursorHideCountType = CreateNewResourceType(CursorFreeHideCount);
-    CursorWindowType = CreateNewResourceType(CursorFreeWindow);
+    CursorClientType = CreateNewResourceTypeNamed(CursorFreeClient,
+						  "XFixesCursorClient");
+    CursorHideCountType = CreateNewResourceTypeNamed(CursorFreeHideCount,
+						     "XFixesCursorHideCount");
+    CursorWindowType = CreateNewResourceTypeNamed(CursorFreeWindow,
+						  "XFixesCursorWindow");
 
     if (pInvisibleCursor == NULL) {
 	pInvisibleCursor = createInvisibleCursor();
diff --git a/xfixes/region.c b/xfixes/region.c
index 6db787f..e1d1a89 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -63,7 +63,7 @@ XFixesRegionCopy (RegionPtr pRegion)
 Bool
 XFixesRegionInit (void)
 {
-    RegionResType = CreateNewResourceType(RegionResFree);
+    RegionResType = CreateNewResourceTypeNamed(RegionResFree, "XFixesRegion");
     return TRUE;
 }
 
diff --git a/xfixes/select.c b/xfixes/select.c
index 12a165f..bc10def 100644
--- a/xfixes/select.c
+++ b/xfixes/select.c
@@ -279,7 +279,9 @@ SelectionFreeWindow (pointer data, XID id)
 Bool
 XFixesSelectionInit (void)
 {
-    SelectionClientType = CreateNewResourceType(SelectionFreeClient);
-    SelectionWindowType = CreateNewResourceType(SelectionFreeWindow);
+    SelectionClientType = CreateNewResourceTypeNamed(SelectionFreeClient,
+						     "XFixesSelectionClient");
+    SelectionWindowType = CreateNewResourceTypeNamed(SelectionFreeWindow,
+						     "XFixesSelectionWindow");
     return SelectionClientType && SelectionWindowType;
 }
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 30d58bf..2f09da6 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -6691,7 +6691,7 @@ XkbExtensionInit(void)
 	XkbEventBase = (unsigned char)extEntry->eventBase;
 	XkbErrorBase = (unsigned char)extEntry->errorBase;
 	XkbKeyboardErrorCode = XkbErrorBase+XkbKeyboard;
-	RT_XKBCLIENT = CreateNewResourceType(XkbClientGone);
+	RT_XKBCLIENT = CreateNewResourceTypeNamed(XkbClientGone, "XkbClient");
     }
     return;
 }
-- 
1.5.6.5



More information about the xorg-devel mailing list