[Mesa-dev] [PATCH shader-db 1/3] run: define extension_string within the specified scope

Emil Velikov emil.l.velikov at gmail.com
Mon Aug 21 10:27:19 UTC 2017


From: Emil Velikov <emil.velikov at 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.velikov at 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);
         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



More information about the mesa-dev mailing list