[waffle] [PATCH 31/33] utils/wlfinfo: use define to provide buffer lenght
Brian Paul
brianp at vmware.com
Mon Jul 7 09:57:46 PDT 2014
In the subject line: "length"
On 07/07/2014 11:28 AM, Emil Velikov wrote:
> ... 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().
>
More information about the waffle
mailing list