[Mesa-dev] [PATCH 6/7] egl: drop unneeded sentinel from level_strings[]

Eric Engestrom eric at engestrom.ch
Fri May 5 13:10:58 UTC 2017



On 4 May 2017 22:26:28 BST, Bartosz Tomczyk <bartosz.tomczyk86 at gmail.com> wrote:
>It should be:
>
>i < ARRAY_SIZE(level_strings)
>

Indeed :)

With this, the series is
Reviewed-by: Eric Engestrom <eric at engestrom.ch>

Cheers,
  Eric

>
>On 04.05.2017 20:47, Emil Velikov wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> The array is local so we already know its size.
>>
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>> ---
>>   src/egl/main/egllog.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
>> index 6f0c0cda6c3..c1e61f9b6c9 100644
>> --- a/src/egl/main/egllog.c
>> +++ b/src/egl/main/egllog.c
>> @@ -41,6 +41,7 @@
>>   #include <string.h>
>>   #include <strings.h>
>>   #include "c11/threads.h"
>> +#include "util/macros.h"
>>   
>>   #include "egllog.h"
>>   
>> @@ -82,7 +83,6 @@ static const char *level_strings[] = {
>>      "warning",
>>      "info",
>>      "debug",
>> -   NULL
>>   };
>>   
>>   
>> @@ -129,7 +129,7 @@ _eglInitLogger(void)
>>   
>>      log_env = getenv("EGL_LOG_LEVEL");
>>      if (log_env) {
>> -      for (i = 0; level_strings[i]; i++) {
>> +      for (i = 0; ARRAY_SIZE(level_strings); i++) {
>>            if (strcasecmp(log_env, level_strings[i]) == 0) {
>>               level = i;
>>               break;
>
>_______________________________________________
>mesa-dev mailing list
>mesa-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list