[Mesa-dev] [PATCH] mesa: use ARRAY_SIZE() macro instead of magic number

Kenneth Graunke kenneth at whitecape.org
Tue Aug 20 11:35:55 PDT 2013


On 08/20/2013 07:23 AM, Brian Paul wrote:
> ---
>   src/mesa/main/get.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 09b008a..4f6f59a 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -709,7 +709,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
>      case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
>         v->value_int_n.n =
>   	 _mesa_get_compressed_formats(ctx, v->value_int_n.ints);
> -      ASSERT(v->value_int_n.n <= 100);
> +      ASSERT(v->value_int_n.n <= ARRAY_SIZE(v->value_int_n.ints));
>         break;
>
>      case GL_MAX_VARYING_FLOATS_ARB:
>

Much nicer.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list