[Mesa-dev] [PATCH mesa 06/13] util: use standard name for strncmp()

Emil Velikov emil.l.velikov at gmail.com
Wed Nov 21 14:24:22 UTC 2018


On 2018/11/20, Eric Engestrom wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> ---
>  src/gallium/auxiliary/hud/hud_context.c | 2 +-
>  src/util/u_string.h                     | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
> index 9f9db850a71dbdbfe6eb..e7e99944993ad8ffaf32 100644
> --- a/src/gallium/auxiliary/hud/hud_context.c
> +++ b/src/gallium/auxiliary/hud/hud_context.c
> @@ -1195,7 +1195,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
>     boolean sort_items = false;
>     const char *period_env;
>  
> -   if (util_strncmp(env, "simple,", 7) == 0) {
> +   if (strncmp(env, "simple,", 7) == 0) {
>        hud->simple = true;
>        env += 7;
>     }
> diff --git a/src/util/u_string.h b/src/util/u_string.h
> index 82c340663b757fcfb3d8..d730412e3b287a38686f 100644
> --- a/src/util/u_string.h
> +++ b/src/util/u_string.h
> @@ -170,6 +170,7 @@ util_strcmp(const char *s1, const char *s2)
>     return 0;
>  }
>  
> +#define strncmp util_strncmp
>  static inline int
>  util_strncmp(const char *s1, const char *s2, size_t n)
>  {
Analogous to the other comments - think we can drop the helper.

HTH
Emil

[1] https://docs.microsoft.com/en-gb/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=vs-2017


More information about the mesa-dev mailing list