[Intel-gfx] [PATCH i-g-t 2/2] tests/gem_pwrite_snooped: fix const cast warning

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Sep 7 05:51:32 PDT 2015


On Mon, Sep 07, 2015 at 12:34:12PM +0100, Thomas Wood wrote:
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
>  tests/gem_pwrite_snooped.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/gem_pwrite_snooped.c b/tests/gem_pwrite_snooped.c
> index d3f6223..29142c3 100644
> --- a/tests/gem_pwrite_snooped.c
> +++ b/tests/gem_pwrite_snooped.c
> @@ -76,14 +76,14 @@ static void blit(drm_intel_bo *dst, drm_intel_bo *src,
>  	intel_batchbuffer_free(batch);
>  }
>  
> -static void *memchr_inv(const void *s, int c, size_t n)
> +static void const *memchr_inv(const void *s, int c, size_t n)

const void *
is the usual way to write that


>  {
>  	const unsigned char *us = s;
>  	unsigned char uc = c;
>  
>  	while (n--) {
>  		if (*us != uc)
> -			return (void *) us;
> +			return (void const *) us;

No need for the cast if you make it return const void *.

>  		us++;
>  	}
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list