Mesa (master): vulkan/wsi/x11: use ARRAY_SIZE where applicable

Emil Velikov evelikov at kemper.freedesktop.org
Fri Mar 16 14:07:16 UTC 2018


Module: Mesa
Branch: master
Commit: 19ec81775636171af4386fe17fc301917c4e97f7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=19ec81775636171af4386fe17fc301917c4e97f7

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Tue Mar 13 11:06:28 2018 +0000

vulkan/wsi/x11: use ARRAY_SIZE where applicable

Use the handy macro instead of hard coded numbers.

Fixes: c80c08e2260 ("vulkan/wsi/x11: Add support for DRI3 v1.2")
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>

---

 src/vulkan/wsi/wsi_common_x11.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 5f29ead3f2..e7a7da1928 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -1398,7 +1398,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
       }
    }
 
-   for (int i = 0; i < 2; i++)
+   for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
       vk_free(pAllocator, modifiers[i]);
    *swapchain_out = &chain->base;
 
@@ -1409,7 +1409,7 @@ fail_init_images:
       x11_image_finish(chain, pAllocator, &chain->images[j]);
 
 fail_register:
-   for (int i = 0; i < 2; i++)
+   for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
       vk_free(pAllocator, modifiers[i]);
 
    xcb_unregister_for_special_event(chain->conn, chain->special_event);




More information about the mesa-commit mailing list