summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-03-10 12:29:34 -0500
committerAdam Jackson <ajax@redhat.com>2016-03-10 15:55:46 -0500
commit47c1d6b7abcfb1c6b478367bbc2e869c91485bc0 (patch)
tree98efb72c35aa12ca82673b33f0d408c5b85fb35b /glx
parentc01094c5312fbd84146dd83122e5256a8e57d092 (diff)
glx: Macroize building the attribute list in DoGetDrawableAttributes
No functional change, just a little easier to read and harder to get wrong. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 6eb3541d0..d8a144fee 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1945,33 +1945,26 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
if (pGlxDraw)
pDraw = pGlxDraw->pDraw;
- attributes[2*num] = GLX_Y_INVERTED_EXT;
- attributes[2*num+1] = GL_FALSE;
- num++;
- attributes[2*num] = GLX_WIDTH;
- attributes[2*num+1] = pDraw->width;
- num++;
- attributes[2*num] = GLX_HEIGHT;
- attributes[2*num+1] = pDraw->height;
- num++;
+#define ATTRIB(a, v) do { \
+ attributes[2*num] = (a); \
+ attributes[2*num+1] = (v); \
+ num++; \
+ } while (0)
+
+ ATTRIB(GLX_Y_INVERTED_EXT, GL_FALSE);
+ ATTRIB(GLX_WIDTH, pDraw->width);
+ ATTRIB(GLX_HEIGHT, pDraw->height);
if (pGlxDraw) {
- attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
- attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
- GLX_TEXTURE_2D_EXT :
- GLX_TEXTURE_RECTANGLE_EXT;
- num++;
- attributes[2*num] = GLX_EVENT_MASK;
- attributes[2*num+1] = pGlxDraw->eventMask;
- num++;
- attributes[2*num] = GLX_FBCONFIG_ID;
- attributes[2*num+1] = pGlxDraw->config->fbconfigID;
- num++;
+ ATTRIB(GLX_TEXTURE_TARGET_EXT,
+ pGlxDraw->target == GL_TEXTURE_2D ?
+ GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT);
+ ATTRIB(GLX_EVENT_MASK, pGlxDraw->eventMask);
+ ATTRIB(GLX_FBCONFIG_ID, pGlxDraw->config->fbconfigID);
if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
- attributes[2*num] = GLX_PRESERVED_CONTENTS;
- attributes[2*num+1] = GL_TRUE;
- num++;
+ ATTRIB(GLX_PRESERVED_CONTENTS, GL_TRUE);
}
}
+#undef ATTRIB
reply = (xGLXGetDrawableAttributesReply) {
.type = X_Reply,