[waffle] [PATCH v2 2/4] wflinfo.c: use ARRAY_SIZE macro
baker.dylan.c at gmail.com
baker.dylan.c at gmail.com
Tue Jan 5 11:46:51 PST 2016
From: Dylan Baker <baker.dylan.c at gmail.com>
v2: - add this patch
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
src/utils/wflinfo.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
index eefb605..4b92222 100644
--- a/src/utils/wflinfo.c
+++ b/src/utils/wflinfo.c
@@ -53,6 +53,8 @@ removeXcodeArgs(int *argc, char **argv);
#include "waffle.h"
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
static const char *usage_message =
"Usage:\n"
" wflinfo <Required Parameters> [Options]\n"
@@ -499,7 +501,6 @@ static struct {
static void
print_context_flags(void)
{
- int flag_count = sizeof(context_flags) / sizeof(context_flags[0]);
GLint gl_context_flags = 0;
printf("OpenGL context flags:");
@@ -515,7 +516,7 @@ print_context_flags(void)
return;
}
- for (int i = 0; i < flag_count; i++) {
+ for (int i = 0; i < ARRAY_SIZE(context_flags); i++) {
if ((context_flags[i].flag & gl_context_flags) != 0) {
printf(" %s", context_flags[i].str);
gl_context_flags = gl_context_flags & ~context_flags[i].flag;
@@ -947,8 +948,6 @@ success:
return true;
}
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
/// Exit on failure.
static void
wflinfo_create_context(struct waffle_display *dpy,
--
2.6.4
More information about the waffle
mailing list