[Mesa-dev] [PATCH 3/4] util: use memcmp instead of strncmp

Ian Romanick idr at freedesktop.org
Tue May 30 23:42:13 UTC 2017


I believe this change is correct, but does it have any measurable
benefit?  Reduction in generated code size, perhaps?

On 05/30/2017 03:45 PM, Vlad Golovkin wrote:
> ---
>  src/util/debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/debug.c b/src/util/debug.c
> index 98b1853325..78041d414f 100644
> --- a/src/util/debug.c
> +++ b/src/util/debug.c
> @@ -42,7 +42,7 @@ parse_debug_string(const char *debug,
>  
>              for (; n = strcspn(s, ", "), *s; s += MAX2(1, n)) {
>                 if (strlen(control->string) == n &&
> -                   !strncmp(control->string, s, n))
> +                   !memcmp(control->string, s, n))
>                    flag |= control->flag;
>              }
>           }
> 



More information about the mesa-dev mailing list