[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 17:01:57 UTC 2017


On 21 August 2017 at 14:27, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> On Monday, 2017-08-21 11:27:19 +0100, Emil Velikov wrote:
>> 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);
>
> 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)?
>
Indeed - current patch is a silly. Barring any objections, I'll respin
with your suggestion tomorrow.

-Emil


More information about the mesa-dev mailing list