[Mesa-dev] [PATCH 1/2] mesa: fix coding style of case statement

Brian Paul brianp at vmware.com
Thu Sep 5 10:02:44 PDT 2013


On 09/05/2013 03:57 AM, Timothy Arceri wrote:
>
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
>   src/mesa/main/objectlabel.c |  124 +++++++++++++++++++++----------------------
>   1 file changed, 62 insertions(+), 62 deletions(-)
>
> diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
> index 90d9e09..7e39c92 100644
> --- a/src/mesa/main/objectlabel.c
> +++ b/src/mesa/main/objectlabel.c
> @@ -117,78 +117,78 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
>      char **labelPtr = NULL;
>
>      switch (identifier) {
> -   case GL_BUFFER:
> -      {
> -         struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
> -         if (bufObj)
> -            labelPtr = &bufObj->Label;
> -      }
> +   case GL_BUFFER: {
> +      struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
> +      if (bufObj)
> +         labelPtr = &bufObj->Label;
>         break;
> -   case GL_SHADER:
> -      {
> -         struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
> -         if (shader)
> -            labelPtr = &shader->Label;
> -      }
> +   }
> +
> +   case GL_SHADER: {
> +      struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
> +      if (shader)
> +         labelPtr = &shader->Label;
>         break;
> -   case GL_PROGRAM:
> -      {
> -         struct gl_shader_program *program =
> -            _mesa_lookup_shader_program(ctx, name);
> -         if (program)
> -            labelPtr = &program->Label;
> -      }
> +   }
> +
> +   case GL_PROGRAM: {
> +      struct gl_shader_program *program =
> +         _mesa_lookup_shader_program(ctx, name);
> +      if (program)
> +         labelPtr = &program->Label;
>         break;
> -   case GL_VERTEX_ARRAY:
> -      {
> -         struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, name);
> -         if (obj)
> -            labelPtr = &obj->Label;
> -      }
> +   }
> +
> +   case GL_VERTEX_ARRAY: {
> +      struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, name);
> +      if (obj)
> +         labelPtr = &obj->Label;
>         break;
> -   case GL_QUERY:
> -      {
> -         struct gl_query_object *query = _mesa_lookup_query_object(ctx, name);
> -         if (query)
> -            labelPtr = &query->Label;
> -      }
> +   }
> +
> +   case GL_QUERY: {
> +      struct gl_query_object *query = _mesa_lookup_query_object(ctx, name);
> +      if (query)
> +         labelPtr = &query->Label;
>         break;
> -   case GL_TRANSFORM_FEEDBACK:
> -      {
> -         struct gl_transform_feedback_object *tfo =
> -            _mesa_lookup_transform_feedback_object(ctx, name);
> -         if (tfo)
> -            labelPtr = &tfo->Label;
> -      }
> +   }
> +
> +   case GL_TRANSFORM_FEEDBACK: {
> +      struct gl_transform_feedback_object *tfo =
> +         _mesa_lookup_transform_feedback_object(ctx, name);
> +      if (tfo)
> +         labelPtr = &tfo->Label;
>         break;
> -   case GL_SAMPLER:
> -      {
> -         struct gl_sampler_object *so = _mesa_lookup_samplerobj(ctx, name);
> -         if (so)
> -            labelPtr = &so->Label;
> -      }
> +   }
> +
> +   case GL_SAMPLER: {
> +      struct gl_sampler_object *so = _mesa_lookup_samplerobj(ctx, name);
> +      if (so)
> +         labelPtr = &so->Label;
>         break;
> -   case GL_TEXTURE:
> -      {
> -         struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
> -         if (texObj)
> -            labelPtr = &texObj->Label;
> -      }
> +   }
> +
> +   case GL_TEXTURE: {
> +      struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
> +      if (texObj)
> +         labelPtr = &texObj->Label;
>         break;
> -   case GL_RENDERBUFFER:
> -      {
> -         struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name);
> -         if (rb)
> -            labelPtr = &rb->Label;
> -      }
> +   }
> +
> +   case GL_RENDERBUFFER: {
> +      struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name);
> +      if (rb)
> +         labelPtr = &rb->Label;
>         break;
> -   case GL_FRAMEBUFFER:
> -      {
> -         struct gl_framebuffer *rb = _mesa_lookup_framebuffer(ctx, name);
> -         if (rb)
> -            labelPtr = &rb->Label;
> -      }
> +   }
> +
> +   case GL_FRAMEBUFFER: {
> +      struct gl_framebuffer *rb = _mesa_lookup_framebuffer(ctx, name);
> +      if (rb)
> +         labelPtr = &rb->Label;
>         break;
> +   }
> +
>      case GL_DISPLAY_LIST:
>         if (ctx->API == API_OPENGL_COMPAT) {
>            struct gl_display_list *list = _mesa_lookup_list(ctx, name);
>

FWIW, I'm happy with the code as-is.  I wrote it that way.

-Brian



More information about the mesa-dev mailing list