[PATCH 4/4 (v2)] Replace SecurityLookupIDByClass() with dixLookupResourceByClass().

Cyril Brulebois kibi at debian.org
Fri Nov 12 12:12:33 PST 2010


This patch has been prepared with the following Coccinelle semantic patch:

@@
expression a, b, c, d;
identifier r;
type t;
@@
-r = (t) SecurityLookupIDByClass(a, b, c, d);
+dixLookupResourceByClass((pointer*) &r, b, c, a, d);

The only occurrence not matching directly was processed after separating
declaration of pXinDraw and call to SecurityLookupIDByClass().

Signed-off-by: Cyril Brulebois <kibi at debian.org>
---
 hw/dmx/glxProxy/glxcmds.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 0d664a8..49ab35a 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -1104,14 +1104,16 @@ static int MakeCurrent(__GLXclientState *cl,
        to_screen = screenInfo.numScreens - 1;
 
        if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
-	  pXinDraw = (PanoramiXRes *)
-	     SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+	  dixLookupResourceByClass((pointer*) &pXinDraw,
+				   pDraw->id, XRC_DRAWABLE,
+				   client, DixReadAccess);
        }
 
        if (pReadDraw && pReadDraw != pDraw && 
 	     new_reply.readType != GLX_PBUFFER_TYPE) {
-	  pXinReadDraw = (PanoramiXRes *)
-	     SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess);
+	  dixLookupResourceByClass((pointer*) &pXinReadDraw,
+				   pReadDraw->id, XRC_DRAWABLE,
+				   client, DixReadAccess);
        }
        else {
 	  pXinReadDraw = pXinDraw;
@@ -1765,8 +1767,9 @@ static int CreateGLXPixmap(__GLXclientState *cl,
        from_screen = 0;
        to_screen = screenInfo.numScreens - 1;
 
-       pXinDraw = (PanoramiXRes *)
-	  SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+       dixLookupResourceByClass((pointer*) &pXinDraw,
+				pDraw->id, XRC_DRAWABLE,
+				client, DixReadAccess);
     }
 #endif
 
@@ -2013,8 +2016,9 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
     if (!noPanoramiXExtension) {
        from_screen = 0;
        to_screen = screenInfo.numScreens - 1;
-       pXinDraw = (PanoramiXRes *)
-        SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+       dixLookupResourceByClass((pointer*) &pXinDraw,
+				pDraw->id, XRC_DRAWABLE,
+				client, DixReadAccess);
     }
 #endif
 
@@ -3369,9 +3373,9 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 
 #ifdef PANORAMIX
        if (!noPanoramiXExtension) {
-	  pXinDraw = (PanoramiXRes *)
-	     SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
-	  if (!pXinDraw) {
+	  if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
+						  pDraw->id, XRC_DRAWABLE,
+						  client, DixReadAccess)) {
 	     client->errorValue = drawId;
 	     return __glXBadDrawable;
 	  }
@@ -3533,9 +3537,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 
 #ifdef PANORAMIX
        if (!noPanoramiXExtension) {
-	  PanoramiXRes *pXinDraw = (PanoramiXRes *)
-	     SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
-	  if (!pXinDraw) {
+	  PanoramiXRes *pXinDraw;
+	  if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
+						  pDraw->id, XRC_DRAWABLE,
+						  client, DixReadAccess)) {
 	     client->errorValue = drawId;
 	     return __glXBadDrawable;
 	  }
-- 
1.7.2.3



More information about the xorg-devel mailing list