summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-09-21 21:24:01 -0700
committerMatt Turner <[email protected]>2014-12-08 17:02:19 -0800
commit8af4aaf351313f9d4692697bf28d3c3f84e01ca4 (patch)
tree3d7fdabf8fc729efef9d011ac583acd0b7ae8e3d /src/mesa
parentf0a8bcd84e50468a703a0ac366a4e067610df30c (diff)
Don't cast the return value of malloc/realloc
See commit 2b7a972e for the Coccinelle script. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c3
-rw-r--r--src/mesa/drivers/x11/xm_api.c2
-rw-r--r--src/mesa/main/imports.c4
-rw-r--r--src/mesa/main/objectlabel.c2
-rw-r--r--src/mesa/main/shaderapi.c5
-rw-r--r--src/mesa/program/prog_instruction.c8
-rw-r--r--src/mesa/program/prog_parameter.c2
7 files changed, 9 insertions, 17 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index ee05f8aaa3d..33c024a8c07 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -326,8 +326,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
*/
xmvis->vishandle = vinfo;
/* Allocate more space for additional visual */
- VisualTable = (XMesaVisual *) realloc( VisualTable,
- sizeof(XMesaVisual) * (NumVisuals + 1));
+ VisualTable = realloc(VisualTable, sizeof(XMesaVisual) * (NumVisuals + 1));
/* add xmvis to the list */
VisualTable[NumVisuals] = xmvis;
NumVisuals++;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 2d66dbdcdf1..b49133b730d 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -783,7 +783,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
* the struct but we may need some of the information contained in it
* at a later time.
*/
- v->visinfo = (XVisualInfo *) malloc(sizeof(*visinfo));
+ v->visinfo = malloc(sizeof(*visinfo));
if(!v->visinfo) {
free(v);
return NULL;
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 4f5a2d11fa9..6945c2f621b 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -94,7 +94,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
ASSERT( alignment > 0 );
- ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *));
+ ptr = malloc(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
@@ -143,7 +143,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
ASSERT( alignment > 0 );
- ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *));
+ ptr = calloc(1, bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index efa7ba8d19a..78df96b9ba8 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -58,7 +58,7 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label,
MAX_LABEL_LENGTH);
/* explicit length */
- *labelPtr = (char *) malloc(length+1);
+ *labelPtr = malloc(length+1);
if (*labelPtr) {
memcpy(*labelPtr, label, length);
/* length is not required to include the null terminator so
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 66578204f08..6d831f7621d 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -274,9 +274,8 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
}
/* grow list */
- shProg->Shaders = (struct gl_shader **)
- realloc(shProg->Shaders,
- (n + 1) * sizeof(struct gl_shader *));
+ shProg->Shaders = realloc(shProg->Shaders,
+ (n + 1) * sizeof(struct gl_shader *));
if (!shProg->Shaders) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader");
return;
diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
index 976024e3c7b..c1b952754f1 100644
--- a/src/mesa/program/prog_instruction.c
+++ b/src/mesa/program/prog_instruction.c
@@ -87,13 +87,7 @@ struct prog_instruction *
_mesa_realloc_instructions(struct prog_instruction *oldInst,
GLuint numOldInst, GLuint numNewInst)
{
- struct prog_instruction *newInst;
-
- newInst = (struct prog_instruction *)
- realloc(oldInst,
- numNewInst * sizeof(struct prog_instruction));
-
- return newInst;
+ return realloc(oldInst, numNewInst * sizeof(struct prog_instruction));
}
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index 896c6052b84..0ef46415d9f 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -120,7 +120,7 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
paramList->Size = paramList->Size + 4 * sz4;
/* realloc arrays */
- paramList->Parameters = (struct gl_program_parameter *)
+ paramList->Parameters =
realloc(paramList->Parameters,
paramList->Size * sizeof(struct gl_program_parameter));