From a6fad5596141667b0986f083996b05ca829d1f45 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 22 Jun 2017 11:00:41 -0700 Subject: egl/x11: Declare EGLConfig attrib array inside loop No behavioral change. Just a readability cleanup. Instead of modifying this small array on each loop iteration, we now initialize it in-place with the values it needs. Reviewed-by: Eric Engestrom --- src/egl/drivers/dri2/platform_x11.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/egl/drivers/dri2') diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 2a19cdcc746..16cc31340e0 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -730,13 +730,7 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy, xcb_depth_iterator_t d; xcb_visualtype_t *visuals; int count = 0; - unsigned int rgba_masks[4]; EGLint surface_type; - EGLint config_attrs[] = { - EGL_NATIVE_VISUAL_ID, 0, - EGL_NATIVE_VISUAL_TYPE, 0, - EGL_NONE - }; d = xcb_screen_allowed_depths_iterator(dri2_dpy->screen); @@ -763,13 +757,19 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy, struct dri2_egl_config *dri2_conf; const __DRIconfig *config = dri2_dpy->driver_configs[j]; - config_attrs[1] = visuals[i].visual_id; - config_attrs[3] = visuals[i]._class; + const EGLint config_attrs[] = { + EGL_NATIVE_VISUAL_ID, visuals[i].visual_id, + EGL_NATIVE_VISUAL_TYPE, visuals[i]._class, + EGL_NONE + }; + + unsigned int rgba_masks[4] = { + visuals[i].red_mask, + visuals[i].green_mask, + visuals[i].blue_mask, + 0, + }; - rgba_masks[0] = visuals[i].red_mask; - rgba_masks[1] = visuals[i].green_mask; - rgba_masks[2] = visuals[i].blue_mask; - rgba_masks[3] = 0; dri2_conf = dri2_add_config(disp, config, count + 1, surface_type, config_attrs, rgba_masks); if (dri2_conf) -- cgit v1.2.3