[Mesa-dev] [PATCH 1/4] mesa/image: delete dead store

Brian Paul brianp at vmware.com
Wed Oct 19 07:11:57 PDT 2011


On 10/19/2011 06:02 AM, nobled wrote:
> The return value here is a) always zero, b) never used.
> ---
>   src/mesa/main/image.c |    7 -------
>   1 files changed, 0 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
> index 7d95dd6..ca5771c 100644
> --- a/src/mesa/main/image.c
> +++ b/src/mesa/main/image.c
> @@ -1148,16 +1148,9 @@ _mesa_image_address( GLuint dimensions,
>      if (type == GL_BITMAP) {
>         /* BITMAP data */
>         GLint comp_per_pixel;   /* components per pixel */
> -      GLint bytes_per_comp;   /* bytes per component */
>         GLint bytes_per_row;
>         GLint bytes_per_image;
>
> -      /* Compute bytes per component */
> -      bytes_per_comp = _mesa_sizeof_packed_type( type );
> -      if (bytes_per_comp<  0) {
> -         return NULL;
> -      }
> -
>         /* Compute number of components per pixel */
>         comp_per_pixel = _mesa_components_in_format( format );
>         if (comp_per_pixel<  0) {
>

I think we can do more here and remove the 
_mesa_components_in_format() call too.  When type=GL_BITMAP we know 
that format must be GL_COLOR_INDEX or GL_STENCIL_INDEX and that the 
number of components per pixel will be one.

You can do that in a follow-on commit or redo this one.

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list