summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-03 19:44:00 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:50 -0700
commit2b7a972e3f36bfcdc6fbe2b59d7ffdcde49c9405 (patch)
tree4b9504b4799e9d29363690fb9083ac4bbcf78d51 /src/mesa/program
parent812931f602ff913a51a608a9b1b6826b7f2bfae0 (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/program')
-rw-r--r--src/mesa/program/nvfragparse.c4
-rw-r--r--src/mesa/program/nvvertparse.c4
-rw-r--r--src/mesa/program/prog_cache.c4
-rw-r--r--src/mesa/program/prog_instruction.c2
-rw-r--r--src/mesa/program/prog_optimize.c6
-rw-r--r--src/mesa/program/program.c2
6 files changed, 11 insertions, 11 deletions
diff --git a/src/mesa/program/nvfragparse.c b/src/mesa/program/nvfragparse.c
index f61221c1112..ab69a04fcf0 100644
--- a/src/mesa/program/nvfragparse.c
+++ b/src/mesa/program/nvfragparse.c
@@ -1236,7 +1236,7 @@ Parse_PrintInstruction(struct parse_state *parseState,
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
+ msg = malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
@@ -1481,7 +1481,7 @@ _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) malloc(len + 1);
+ programString = malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
diff --git a/src/mesa/program/nvvertparse.c b/src/mesa/program/nvvertparse.c
index 62b27b9f4db..b33056a3990 100644
--- a/src/mesa/program/nvvertparse.c
+++ b/src/mesa/program/nvvertparse.c
@@ -1050,7 +1050,7 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
- msg = (GLubyte*) malloc(len + 1);
+ msg = malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
@@ -1293,7 +1293,7 @@ _mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget,
GLubyte *programString;
/* Make a null-terminated copy of the program string */
- programString = (GLubyte *) malloc(len + 1);
+ programString = malloc(len + 1);
if (!programString) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c
index 2ccedb5d7d0..47f926b1bc6 100644
--- a/src/mesa/program/prog_cache.c
+++ b/src/mesa/program/prog_cache.c
@@ -88,7 +88,7 @@ rehash(struct gl_program_cache *cache)
cache->last = NULL;
size = cache->size * 3;
- items = (struct cache_item**) malloc(size * sizeof(*items));
+ items = malloc(size * sizeof(*items));
memset(items, 0, size * sizeof(*items));
for (i = 0; i < cache->size; i++)
@@ -141,7 +141,7 @@ _mesa_new_program_cache(void)
struct gl_program_cache *cache = CALLOC_STRUCT(gl_program_cache);
if (cache) {
cache->size = 17;
- cache->items = (struct cache_item **)
+ cache->items =
calloc(1, cache->size * sizeof(struct cache_item));
if (!cache->items) {
free(cache);
diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
index 5d6cb476c1d..f9a33d4effe 100644
--- a/src/mesa/program/prog_instruction.c
+++ b/src/mesa/program/prog_instruction.c
@@ -69,7 +69,7 @@ _mesa_init_instructions(struct prog_instruction *inst, GLuint count)
struct prog_instruction *
_mesa_alloc_instructions(GLuint numInst)
{
- return (struct prog_instruction *)
+ return
calloc(1, numInst * sizeof(struct prog_instruction));
}
diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c
index 25d9684b137..e89e8d6a45c 100644
--- a/src/mesa/program/prog_optimize.c
+++ b/src/mesa/program/prog_optimize.c
@@ -260,7 +260,7 @@ _mesa_remove_dead_code_global(struct gl_program *prog)
/*_mesa_print_program(prog);*/
}
- removeInst = (GLboolean *)
+ removeInst =
calloc(1, prog->NumInstructions * sizeof(GLboolean));
/* Determine which temps are read and written */
@@ -604,7 +604,7 @@ _mesa_remove_dead_code_local(struct gl_program *prog)
GLboolean *removeInst;
GLuint i, arg, rem = 0;
- removeInst = (GLboolean *)
+ removeInst =
calloc(1, prog->NumInstructions * sizeof(GLboolean));
for (i = 0; i < prog->NumInstructions; i++) {
@@ -745,7 +745,7 @@ _mesa_remove_extra_moves(struct gl_program *prog)
_mesa_print_program(prog);
}
- removeInst = (GLboolean *)
+ removeInst =
calloc(1, prog->NumInstructions * sizeof(GLboolean));
/*
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 15337f4d8aa..7c1d2f7741f 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -249,7 +249,7 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
while (*p != 0 && *p != '\n')
p++;
len = p - lineStart;
- s = (GLubyte *) malloc(len + 1);
+ s = malloc(len + 1);
memcpy(s, lineStart, len);
s[len] = 0;