[Mesa-dev] [PATCH mesa] st/dri: replace hard-coded array size with ARRAY_SIZE()

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 24 10:51:06 UTC 2017


Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
Could've sworn I had already seen someone post this patch; guess either
I was mistaken, or it got lost on the way.
---
 src/gallium/state_trackers/dri/dri_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 91f50fe8e32ae549c1df..31b2c37bfd0a9b8906b7 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -219,7 +219,7 @@ dri_fill_in_modes(struct dri_screen *screen)
    if (dri_loader_get_cap(screen, DRI_LOADER_CAP_RGBA_ORDERING))
       num_formats = ARRAY_SIZE(mesa_formats);
    else
-      num_formats = 5;
+      num_formats = ARRAY_SIZE(mesa_formats) - 2;
 
    /* Add configs. */
    for (format = 0; format < num_formats; format++) {
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list