x11/dri3: Don't open-code ARRAY_SIZE
authorDaniel Stone <daniels@collabora.com>
Wed, 21 Feb 2018 11:39:09 +0000 (11:39 +0000)
committerDaniel Stone <daniels@collabora.com>
Wed, 21 Feb 2018 21:57:38 +0000 (21:57 +0000)
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/loader/loader_dri3_helper.c
src/loader/meson.build

index 30ea133f7e57b508cd7e429e06c1b3b98be7931f..cb947c58728be7a43a0d8d9d50693b22bb10aeb9 100644 (file)
@@ -33,6 +33,7 @@
 #include <X11/Xlib-xcb.h>
 
 #include "loader_dri3_helper.h"
+#include "util/macros.h"
 
 /* From xmlpool/options.h, user exposed so should be stable */
 #define DRI_CONF_VBLANK_NEVER 0
@@ -233,7 +234,7 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable *draw)
 
    draw->ext->core->destroyDrawable(draw->dri_drawable);
 
-   for (i = 0; i < LOADER_DRI3_NUM_BUFFERS; i++) {
+   for (i = 0; i < ARRAY_SIZE(draw->buffers); i++) {
       if (draw->buffers[i])
          dri3_free_render_buffer(draw, draw->buffers[i]);
    }
@@ -392,7 +393,7 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
       xcb_present_idle_notify_event_t *ie = (void *) ge;
       int b;
 
-      for (b = 0; b < sizeof(draw->buffers) / sizeof(draw->buffers[0]); b++) {
+      for (b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
          struct loader_dri3_buffer *buf = draw->buffers[b];
 
          if (buf && buf->pixmap == ie->pixmap)
index e4455e9a72b24891f58b1347c63e96a5b41aa5c5..2693970182f42ba37f331d4723224d1f10af24aa 100644 (file)
@@ -25,7 +25,7 @@ if with_platform_x11 and with_dri3
     'loader_dri3_helper',
     ['loader_dri3_helper.c', 'loader_dri3_helper.h'],
     c_args : c_vis_args,
-    include_directories : inc_include,
+    include_directories : [inc_include, inc_src],
     dependencies : [
       dep_libdrm, dep_xcb_dri3, dep_xcb_present, dep_xcb_sync, dep_xshmfence,
     ],