glx_pbuffer: Refactor GetDrawableAttribute
authorAdel Gadllah <adel.gadllah@gmail.com>
Mon, 24 Feb 2014 19:44:41 +0000 (20:44 +0100)
committerEric Anholt <eric@anholt.net>
Sat, 8 Mar 2014 00:59:57 +0000 (16:59 -0800)
Move the pdraw != NULL check out so that they don't
have to be duplicated.

Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glx/glx_pbuffer.c

index 411d6e572f1c5ad66b72e43776bbeff3554ebcd8..978730cecb32a0121f6eb591f5c0235cfbafe0ad 100644 (file)
@@ -350,6 +350,9 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
          _XEatData(dpy, length);
       }
       else {
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
+#endif
          _XRead(dpy, (char *) data, length * sizeof(CARD32));
 
          /* Search the set of returned attributes for the attribute requested by
@@ -363,13 +366,11 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
          }
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-         {
-            __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
-
-            if (pdraw != NULL && !pdraw->textureTarget)
+         if (pdraw != NULL) {
+            if (!pdraw->textureTarget)
                pdraw->textureTarget =
                   determineTextureTarget((const int *) data, num_attributes);
-            if (pdraw != NULL && !pdraw->textureFormat)
+            if (!pdraw->textureFormat)
                pdraw->textureFormat =
                   determineTextureFormat((const int *) data, num_attributes);
          }