On Monday, 2017-08-21 11:27:19 +0100, Emil Velikov wrote: > From: Emil Velikov <emil.veli...@collabora.com> > > The same declaration was being used for two distinct things - a short > list of EGL and the core GL extensions. > > In the former it is a const string, while the latter is a dynamically > managed list of extensions. > > Define the variables within the specific scope. > > Signed-off-by: Emil Velikov <emil.veli...@collabora.com> > --- > run.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/run.c b/run.c > index c001447..afc5ba0 100644 > --- a/run.c > +++ b/run.c > @@ -446,8 +446,8 @@ main(int argc, char **argv) > "EGL_KHR_create_context", > "EGL_KHR_surfaceless_context" > }; > - char *extension_string = eglQueryString(egl_dpy, EGL_EXTENSIONS); > for (int i = 0; i < ARRAY_SIZE(egl_extension); i++) { > + const char *extension_string = eglQueryString(egl_dpy, > EGL_EXTENSIONS);
Not sure moving the query inside the loop is a good idea. (it's a relatively small loop, but still, on principle) Keeping just the second hunk below already achieves what you want, but with variable shadowing, which I'm not a fan of. How about renaming the two `extension_string` variables throughout the function to `{egl,gl}_extension_string` (on top on the 2nd hunk)? > if (strstr(extension_string, egl_extension[i]) == NULL) { > fprintf(stderr, "ERROR: Missing %s\n", egl_extension[i]); > ret = -1; > @@ -484,6 +484,8 @@ main(int argc, char **argv) > if (core_ctx != EGL_NO_CONTEXT && > eglMakeCurrent(egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, core_ctx)) { > int num_extensions; > + char *extension_string; > + > glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); > > size_t extension_string_size = num_extensions * 26; > -- > 2.13.3 > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev