[Mesa-dev] [PATCH] mesa: remove array size so the static assert can work

Eric Anholt eric at anholt.net
Mon Oct 29 13:40:00 PDT 2012


Brian Paul <brianp at vmware.com> writes:

> With the explit NUM_TEXTURE_TARGETS array size, the assertion that
> Elements(targets) == NUM_TEXTURE_TARGETS would pass even if elements
> were missing.
> ---
>  src/mesa/main/shared.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
> index fab2995..2d2f7bd 100644
> --- a/src/mesa/main/shared.c
> +++ b/src/mesa/main/shared.c
> @@ -89,7 +89,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
>     /* Create default texture objects */
>     for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
>        /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */
> -      static const GLenum targets[NUM_TEXTURE_TARGETS] = {
> +      static const GLenum targets[] = {
>           GL_TEXTURE_BUFFER,
>           GL_TEXTURE_2D_ARRAY_EXT,
>           GL_TEXTURE_1D_ARRAY_EXT,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121029/8fd177b7/attachment.pgp>


More information about the mesa-dev mailing list