egl: Rename 'count' in ${platform}_add_configs_for_visuals (v2)
authorChad Versace <chadversary@chromium.org>
Thu, 22 Jun 2017 18:00:41 +0000 (11:00 -0700)
committerChad Versace <chadversary@chromium.org>
Thu, 22 Jun 2017 19:35:49 +0000 (12:35 -0700)
Rename 'count' to 'config_count'. I didn't understand what the variable
did until I untangled the for-loops. Now the next person won't have that
problem.

v2: Rebase. Fix typo. Apply to all platforms (for emil).

Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_surfaceless.c
src/egl/drivers/dri2/platform_x11.c

index 320ae25f46c2e3f3946792959859217ec4ac5493..acd45dab4d70a2c51a65ab1807212884f37f278e 100644 (file)
@@ -1036,7 +1036,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
    };
 
    unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
-   int count = 0;
+   int config_count = 0;
 
    /* The nesting of loops is significant here. Also significant is the order
     * of the HAL pixel formats. Many Android apps (such as Google's official
@@ -1070,11 +1070,11 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
 
          struct dri2_egl_config *dri2_conf =
             dri2_add_config(dpy, dri2_dpy->driver_configs[j],
-                            count + 1, surface_type, config_attrs,
+                            config_count + 1, surface_type, config_attrs,
                             visuals[i].rgba_masks);
          if (dri2_conf) {
-            if (dri2_conf->base.ConfigID == count + 1)
-               count++;
+            if (dri2_conf->base.ConfigID == config_count + 1)
+               config_count++;
             format_count[i]++;
          }
       }
@@ -1087,7 +1087,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       }
    }
 
-   return (count != 0);
+   return (config_count != 0);
 }
 
 static int
index 11928225b99e90c9b7ef017a19d1dde7f1dcafbd..9b4a942b60f816c94f1db78c2df3834a18f145ff 100644 (file)
@@ -600,7 +600,7 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
    };
 
    unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
-   unsigned int count = 0;
+   unsigned int config_count = 0;
 
    for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++) {
       unsigned int red, alpha;
@@ -622,10 +622,10 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
          };
 
          dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
-               count + 1, EGL_WINDOW_BIT, attr_list, NULL);
+               config_count + 1, EGL_WINDOW_BIT, attr_list, NULL);
          if (dri2_conf) {
-            if (dri2_conf->base.ConfigID == count + 1)
-               count++;
+            if (dri2_conf->base.ConfigID == config_count + 1)
+               config_count++;
             format_count[j]++;
          }
       }
@@ -638,7 +638,7 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
       }
    }
 
-   return (count != 0);
+   return (config_count != 0);
 }
 
 static const struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
index d780ce4955cbacd118663fbaad03aa4fc29f600f..1091b4febdb7b3e77c1b31d6d0914f3494a73bf2 100644 (file)
@@ -201,18 +201,19 @@ surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       { "RGB565",   { 0x00f800, 0x07e0, 0x1f, 0x0 } },
    };
    unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
-   unsigned int count = 0;
+   unsigned int config_count = 0;
 
    for (unsigned i = 0; dri2_dpy->driver_configs[i] != NULL; i++) {
       for (unsigned j = 0; j < ARRAY_SIZE(visuals); j++) {
          struct dri2_egl_config *dri2_conf;
 
          dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[i],
-               count + 1, EGL_PBUFFER_BIT, NULL, visuals[j].rgba_masks);
+               config_count + 1, EGL_PBUFFER_BIT, NULL,
+               visuals[j].rgba_masks);
 
          if (dri2_conf) {
-            if (dri2_conf->base.ConfigID == count + 1)
-               count++;
+            if (dri2_conf->base.ConfigID == config_count + 1)
+               config_count++;
             format_count[j]++;
          }
       }
@@ -225,7 +226,7 @@ surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       }
    }
 
-   return (count != 0);
+   return (config_count != 0);
 }
 
 static const struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = {
index 16cc31340e04294053c42152d3a1717339c5afe0..35612300768594c6abc37d1331b67df50dbea789 100644 (file)
@@ -729,7 +729,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;
+   int config_count = 0;
    EGLint surface_type;
 
    d = xcb_screen_allowed_depths_iterator(dri2_dpy->screen);
@@ -770,11 +770,12 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
                0,
             };
 
-            dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
-                                        config_attrs, rgba_masks);
+            dri2_conf = dri2_add_config(disp, config, config_count + 1,
+                                        surface_type, config_attrs,
+                                        rgba_masks);
             if (dri2_conf)
-               if (dri2_conf->base.ConfigID == count + 1)
-                  count++;
+               if (dri2_conf->base.ConfigID == config_count + 1)
+                  config_count++;
 
             /* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
              * Otherwise it will only match a 32-bit RGBA visual.  On a
@@ -786,11 +787,12 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
             if (d.data->depth == 24) {
                rgba_masks[3] =
                   ~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
-               dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
-                                           config_attrs, rgba_masks);
+               dri2_conf = dri2_add_config(disp, config, config_count + 1,
+                                           surface_type, config_attrs,
+                                           rgba_masks);
                if (dri2_conf)
-                  if (dri2_conf->base.ConfigID == count + 1)
-                     count++;
+                  if (dri2_conf->base.ConfigID == config_count + 1)
+                     config_count++;
             }
         }
       }
@@ -798,7 +800,7 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
       xcb_depth_next(&d);
    }
 
-   if (!count) {
+   if (!config_count) {
       _eglLog(_EGL_WARNING, "DRI2: failed to create any config");
       return EGL_FALSE;
    }