[Mesa-dev] [PATCH 06/12] intel: Fix a warning in the release build.

Eric Anholt eric at anholt.net
Thu Apr 11 11:06:33 PDT 2013


This was silly -- checking that we didn't overflow the array by dividing
the array size by 2 and then multiplying it back up by 2.
---
 src/mesa/drivers/dri/intel/intel_context.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 797a4c8..30743fa 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -1039,7 +1039,6 @@ intel_query_dri2_buffers(struct intel_context *intel,
    struct gl_framebuffer *fb = drawable->driverPrivate;
    int i = 0;
    unsigned attachments[8];
-   const int max_attachments = ARRAY_SIZE(attachments) / 2;
 
    struct intel_renderbuffer *front_rb;
    struct intel_renderbuffer *back_rb;
@@ -1060,7 +1059,7 @@ intel_query_dri2_buffers(struct intel_context *intel,
       attachments[i++] = intel_bits_per_pixel(back_rb);
    }
 
-   assert(i <= 2 * max_attachments);
+   assert(i <= ARRAY_SIZE(attachments));
 
    *buffers = screen->dri2.loader->getBuffersWithFormat(drawable,
 							&drawable->w,
-- 
1.7.10.4



More information about the mesa-dev mailing list