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/main/dlist.c | |
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/main/dlist.c')
-rw-r--r-- | src/mesa/main/dlist.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5a813e98ac3..40e69336478 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -573,7 +573,7 @@ make_list(GLuint name, GLuint count) { struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list); dlist->Name = name; - dlist->Head = (Node *) malloc(sizeof(Node) * count); + dlist->Head = malloc(sizeof(Node) * count); dlist->Head[0].opcode = OPCODE_END_OF_LIST; return dlist; } @@ -995,7 +995,7 @@ dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes) Node *newblock; n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; n[0].opcode = OPCODE_CONTINUE; - newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE); + newblock = malloc(sizeof(Node) * BLOCK_SIZE); if (!newblock) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list"); return NULL; @@ -3190,7 +3190,7 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) if (n) { n[1].e = map; n[2].i = mapsize; - n[3].data = (void *) malloc(mapsize * sizeof(GLfloat)); + n[3].data = malloc(mapsize * sizeof(GLfloat)); memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat)); } if (ctx->ExecuteFlag) { @@ -5018,7 +5018,7 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4); if (n) { - GLubyte *programCopy = (GLubyte *) malloc(len); + GLubyte *programCopy = malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; @@ -5045,7 +5045,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids) n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2); if (n) { - GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint)); + GLuint *idCopy = malloc(num * sizeof(GLuint)); if (!idCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); return; @@ -5216,7 +5216,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); if (n) { - GLubyte *nameCopy = (GLubyte *) malloc(len); + GLubyte *nameCopy = malloc(len); if (!nameCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); return; @@ -5315,7 +5315,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4); if (n) { - GLubyte *programCopy = (GLubyte *) malloc(len); + GLubyte *programCopy = malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return; |