diff options
author | Matt Turner <[email protected]> | 2012-09-03 19:44:00 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-09-05 22:28:50 -0700 |
commit | 2b7a972e3f36bfcdc6fbe2b59d7ffdcde49c9405 (patch) | |
tree | 4b9504b4799e9d29363690fb9083ac4bbcf78d51 /src/mesa/tnl | |
parent | 812931f602ff913a51a608a9b1b6826b7f2bfae0 (diff) |
Don't cast the return value of malloc/realloc
This patch has been generated by the following Coccinelle semantic
patch:
// Don't cast the return value of malloc/realloc.
//
// Casting the return value of malloc/realloc only stands to hide
// errors.
@@
type T;
expression E1, E2;
@@
- (T)
(
_mesa_align_calloc(E1, E2)
|
_mesa_align_malloc(E1, E2)
|
calloc(E1, E2)
|
malloc(E1)
|
realloc(E1, E2)
)
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r-- | src/mesa/tnl/t_context.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_program.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_texgen.c | 4 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_vertex.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vertex.c | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index aa678393292..df3a11666a8 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -50,7 +50,7 @@ _tnl_CreateContext( struct gl_context *ctx ) /* Create the TNLcontext structure */ - ctx->swtnl_context = tnl = (TNLcontext *) calloc(1, sizeof(TNLcontext)); + ctx->swtnl_context = tnl = calloc(1, sizeof(TNLcontext)); if (!tnl) { return GL_FALSE; diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 271137f8792..f2e76115ec6 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -521,7 +521,7 @@ init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage) /* a few other misc allocations */ _mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); - store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); + store->clipmask = _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); return GL_TRUE; } diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index c757ac52218..79fbf357d1a 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -570,8 +570,8 @@ static GLboolean alloc_texgen_data( struct gl_context *ctx, for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); - store->tmp_f = (GLfloat (*)[3]) malloc(VB->Size * sizeof(GLfloat) * 3); - store->tmp_m = (GLfloat *) malloc(VB->Size * sizeof(GLfloat)); + store->tmp_f = malloc(VB->Size * sizeof(GLfloat) * 3); + store->tmp_m = malloc(VB->Size * sizeof(GLfloat)); return GL_TRUE; } diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 64795a57ed1..8f296f54b40 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -245,7 +245,7 @@ static GLboolean init_vertex_stage( struct gl_context *ctx, _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); - store->clipmask = (GLubyte *) _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); + store->clipmask = _mesa_align_malloc(sizeof(GLubyte)*size, 32 ); if (!store->clipmask || !store->eye.data || diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index 7e83d454d01..ce3e32165ab 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -87,7 +87,7 @@ void _tnl_register_fastpath( struct tnl_clipspace *vtx, fastpath->attr_count = vtx->attr_count; fastpath->match_strides = match_strides; fastpath->func = vtx->emit; - fastpath->attr = (struct tnl_attr_type *) + fastpath->attr = malloc(vtx->attr_count * sizeof(fastpath->attr[0])); for (i = 0; i < vtx->attr_count; i++) { @@ -495,7 +495,7 @@ void _tnl_init_vertices( struct gl_context *ctx, if (max_vertex_size > vtx->max_vertex_size) { _tnl_free_vertices( ctx ); vtx->max_vertex_size = max_vertex_size; - vtx->vertex_buf = (GLubyte *)_mesa_align_calloc(vb_size * max_vertex_size, 32 ); + vtx->vertex_buf = _mesa_align_calloc(vb_size * max_vertex_size, 32 ); invalidate_funcs(vtx); } |