vulkan/wsi/x11: use ARRAY_SIZE where applicable
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 13 Mar 2018 11:06:28 +0000 (11:06 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 16 Mar 2018 13:45:47 +0000 (13:45 +0000)
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@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
src/vulkan/wsi/wsi_common_x11.c

index 5f29ead3f233908c14d47806fad2ac309eb7f633..e7a7da19285908041abf966b310aa20f91fabcd2 100644 (file)
@@ -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);