[PATCH xserver 1/4] glx: Macroize building the attribute list in DoGetDrawableAttributes
Eric Anholt
eric at anholt.net
Thu Mar 10 19:45:50 UTC 2016
Adam Jackson <ajax at redhat.com> writes:
> No functional change, just a little easier to read and harder to get
> wrong.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
> glx/glxcmds.c | 38 +++++++++++++++-----------------------
> 1 file changed, 15 insertions(+), 23 deletions(-)
>
> diff --git a/glx/glxcmds.c b/glx/glxcmds.c
> index 6eb3541..65d0739 100644
> --- a/glx/glxcmds.c
> +++ b/glx/glxcmds.c
> @@ -1945,31 +1945,23 @@ 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) { \
> + attributes[2*num] = (a); \
> + attributes[2*num+1] = (v); \
> + num++; \
> + }
I think some compilers/static checkers will whine unless this is a do {
... } while (0) macro, becauuse of the "stray" semicolons we end up with
otherwise. With that changed,
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160310/ca4b096b/attachment.sig>
More information about the xorg-devel
mailing list