[waffle] [PATCH 31/33] utils/wlfinfo: use define to provide buffer lenght
Emil Velikov
emil.l.velikov at gmail.com
Mon Jul 7 10:28:38 PDT 2014
... as char buffer[const int] does not work under msvc.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/utils/wflinfo.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
index a76f9fc..94ecfea 100644
--- a/src/utils/wflinfo.c
+++ b/src/utils/wflinfo.c
@@ -760,26 +760,27 @@ gl_get_version(void)
static bool
gl_has_extension_GetString(const char *name)
{
- const size_t buf_len = 4096;
- char exts[buf_len];
+#define BUF_LEN 4096
+ char exts[BUF_LEN];
const uint8_t *exts_orig = glGetString(GL_EXTENSIONS);
if (glGetError()) {
error_printf("Wflinfo", "glGetInteger(GL_EXTENSIONS) failed");
}
- memcpy(exts, exts_orig, buf_len);
- exts[buf_len - 1] = 0;
+ memcpy(exts, exts_orig, BUF_LEN);
+ exts[BUF_LEN - 1] = 0;
char *ext = strtok(exts, " ");
do {
- if (strneq(ext, name, buf_len)) {
+ if (strneq(ext, name, BUF_LEN)) {
return true;
}
ext = strtok(NULL, " ");
} while (ext);
return false;
+#undef BUF_LEN
}
/// @brief Check if current context has an extension using glGetStringi().
--
2.0.0
More information about the waffle
mailing list